Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raise exception to close connection without response (aka nginx 444) #3495

Closed
samuelcolvin opened this issue Jan 7, 2019 · 5 comments
Closed

Comments

@samuelcolvin
Copy link
Member

Feature request

(or perhaps this already possible, but I can't find where it's documented?)

Would be useful occasionally to be able to close a connection without a response, roughly equivalent to nginx's 444 pseudo response.

I guess best implemented as another exception similar to HTTPInternalServerError except closing the connection instead of return 500.

eg. ServerCloseConnection.

Is this possible cleanly and if so would it be useful?

@aio-libs-bot

This comment has been minimized.

@webknjaz
Copy link
Member

webknjaz commented Jan 7, 2019

According to https://habr.com/post/415565/ this causes modern browsers to to a ton of RETRIES. So I'm not sure whether it's very useful nowadays.

wrt naming I'd probably go for ConnectionClosedWithoutResponse as per https://httpstatuses.com/444

@kxepal
Copy link
Member

kxepal commented Jan 7, 2019

Today you can just raise asyncio.CancelledError from request handler to close connection without response. Do we need another one for this case? It named quite clean and it acts the same way as if client closes connection on their side before server returned any response.

@samuelcolvin
Copy link
Member Author

Agree with both of you.

CancelledError should suffice, if someone wanted a different exception (eg. to tell error logging middleware that the server cancelled the response) they could just subclass CancelledError.

@lock
Copy link

lock bot commented Jan 7, 2020

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Jan 7, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Jan 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants