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

[4.x] Don't hang on a 103 response #7938

Closed
wants to merge 5 commits into from
Closed

Conversation

yschimke
Copy link
Collaborator

Race condition means that a 103 might be considered to complete a request, such that the the actual headers are considered trailers.

#fixes #7936

@yschimke yschimke changed the title Don't hang on a 103 response [4.x] Don't hang on a 103 response Jul 22, 2023
@@ -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()
Copy link
Collaborator

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

Copy link
Collaborator Author

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.

Copy link
Collaborator

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?

Copy link
Collaborator Author

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() {
Copy link
Collaborator

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?

Copy link
Collaborator Author

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.

@yschimke
Copy link
Collaborator Author

I'll check and update this weekend.

@yschimke yschimke closed this Oct 15, 2023
@yschimke yschimke deleted the 103_4x branch October 15, 2023 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants