The HTTP and HTTPS clients have no way to read a response body correctly, because there is no RFC-7230 message-framing logic anywhere in the library. Grepping the tree for Transfer-Encoding, chunked, Content-Length or any body-reading helper returns nothing (checked in V1.4.0 and current main / V1.5.0).
Symptom
Issuing a GET against any real-world server and trying to read the body via stream::await / resolve / pipe gives a truncated body, a hang, or the raw chunked framing bytes mixed into the payload — depending on how the server chose to frame the response. There is no correct way to consume the body today.
Why it can't be worked around cleanly at the call site
The caller cannot know which of the three framings the server used without parsing the headers and then applying the matching read strategy — which is precisely the logic that belongs in the client.
What's needed
A read_body() on the http/https client implementing the standard three cases:
Transfer-Encoding: chunked → read and de-chunk until the terminating zero-length chunk
Content-Length: N → read exactly N bytes
- neither → read until the server closes the connection (close-terminated)
We have implemented exactly this as an additive http::read_body() / https::read_body() (~186 lines, no change to stream::await / resolve / pipe, so nothing existing breaks). Happy to open a PR if you want it.
Related, and arguably a regression
V1.5.0 appears to have removed the request-side Content-Length write that V1.4.0 had. If so, an outgoing POST body is now itself unframeable — the same class of bug in the other direction. Worth a look.
The HTTP and HTTPS clients have no way to read a response body correctly, because there is no RFC-7230 message-framing logic anywhere in the library. Grepping the tree for
Transfer-Encoding,chunked,Content-Lengthor any body-reading helper returns nothing (checked in V1.4.0 and currentmain/ V1.5.0).Symptom
Issuing a GET against any real-world server and trying to read the body via
stream::await/resolve/pipegives a truncated body, a hang, or the raw chunked framing bytes mixed into the payload — depending on how the server chose to frame the response. There is no correct way to consume the body today.Why it can't be worked around cleanly at the call site
The caller cannot know which of the three framings the server used without parsing the headers and then applying the matching read strategy — which is precisely the logic that belongs in the client.
What's needed
A
read_body()on the http/https client implementing the standard three cases:Transfer-Encoding: chunked→ read and de-chunk until the terminating zero-length chunkContent-Length: N→ read exactly N bytesWe have implemented exactly this as an additive
http::read_body()/https::read_body()(~186 lines, no change tostream::await/resolve/pipe, so nothing existing breaks). Happy to open a PR if you want it.Related, and arguably a regression
V1.5.0 appears to have removed the request-side
Content-Lengthwrite that V1.4.0 had. If so, an outgoingPOSTbody is now itself unframeable — the same class of bug in the other direction. Worth a look.