-
Notifications
You must be signed in to change notification settings - Fork 9.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
[4.x] Don't hang on a 103 response #7938
Conversation
@@ -283,7 +285,10 @@ class Http2Stream internal constructor( | |||
val open: Boolean | |||
synchronized(this) { | |||
if (!hasResponseHeaders || !inFinished) { | |||
hasResponseHeaders = true | |||
val status = headers[Header.RESPONSE_STATUS_UTF8]?.toIntOrNull() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mind retargeting master
, then cherry-picking this back to okhttp_4x ?
I’m a little surprised to see status codes handled at this layer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it went here so I could make the minimal change.
I can try again to apply some of the changes directly, it's been a while, so it's a bit vague why it broken down.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m still not a fan of handling status codes at the protocol layer. Revert this part and keep the fix for the infinite wait?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels unfortunate. I really would like to handle this properly in 4.12.
private var client = clientTestRule.newClient() | ||
private var client = clientTestRule.newClientBuilder() | ||
.followRedirects(false) | ||
.build() | ||
|
||
@Test | ||
fun test103() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does master have this test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this is a manual test, see line 24. The problem is mockwebserver in 4.x doesn't have support for informational responses. So tests on master are better.
I'll check and update this weekend. |
Race condition means that a 103 might be considered to complete a request, such that the the actual headers are considered trailers.
#fixes #7936