-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Response context release #1571
Response context release #1571
Conversation
I don't think this is good solution. What would happen if http message actually malformed? In that case we cannot release connection |
if it's malformed it should be handled where it's detected that it's malformed. The problem with this is that the exception can be anything, in my case I was just raising Exception from w/in the context causing it to close the connection for no reason. |
but when we do |
can't |
transport is just opaque bytes stream. connection can be broken on http level |
either way the existing code is wrong, how do you know if an exception is not thrown that the transport can be released? |
if request parser completes http message parsing then connection is ready for re-use |
ok how does this sound, if http header parsing does not finish and exception is thrown close connection, otherwise release? |
btw what exception do you get? you also can print |
here's the issue: async with http_session.get("http://foobar.com") as response:
if resp.status != 200:
raise Exception this should not cause the connection to be closed as it can be re-used. |
ok, that makes sense |
here is what you need to do:
|
actually, wait a bit |
could you squash your commits? |
i modified release method, it should be save to call it even if connection is broken |
thank you so much for the quick work! I'm sure this has been lurking unnoticed in several people's workflows without them noticing since it "worked" before but would result in things moving slower than they needed to otherwise :) |
this may fix one of the issues, but to fix buggy ssl servers with need close timeout. |
what I'm doing locally is a custom release that forces |
don't close connections on exceptions as the library can't make that decision at this point. See discussion in #1568