Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jsha
Copy link
Collaborator

@jsha jsha commented Mar 14, 2021

Remove consideration of Connection: close in determining response body
size. A response can have Content-Length in addition to Connection:
close.

Remove consideration of HTTP version. An HTTP/1.0 response can have a
Content-Length.

Add consideration of Transfer-Encoding, which is specified to take
precedence over Content-Length.

No-body response codes take precedence over any Transfer-Encoding that
might be present, and enforce a body size of 0.

Explicitly reject a Content-Length header on no-body response codes.

I noticed this when testing against a server that sent HTTP/1.0, Connection: close, and a Content-Length, but didn't actually close the connection; this caused cureq to wait indefinitely.

Draft because I need to write unit tests.

Remove consideration of `Connection: close` in determining response body
size. A response can have Content-Length in addition to Connection:
close.

Remove consideration of HTTP version. An HTTP/1.0 response can have a
Content-Length.

Add consideration of Transfer-Encoding, which is specified to take
precedence over Content-Length.

No-body response codes take precedence over any Transfer-Encoding that
might be present, and enforce a body size of 0.

Explicitly reject a Content-Length header on no-body response codes.
Copy link
Owner

@algesten algesten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like where this is going.

Box::new(PoolReturnRead::new(unit, LimitedRead::new(stream, 0)))
}
(true, _) => {
trace!("building ChunkDecoder");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe all these trace! logs can be on the form "Using ChunkDecoder", "Using LimitRead with limit {}", etc.

@jsha
Copy link
Collaborator Author

jsha commented Jun 14, 2023

Obsoleted by #625

@jsha jsha closed this Jun 14, 2023
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