Skip to content
This repository has been archived by the owner on Jul 18, 2023. It is now read-only.

Adjust Response headers for gzipped body #1

Open
mindplay-dk opened this issue Jul 30, 2019 · 1 comment
Open

Adjust Response headers for gzipped body #1

mindplay-dk opened this issue Jul 30, 2019 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@mindplay-dk
Copy link
Collaborator

mindplay-dk commented Jul 30, 2019

If the Response body is unpacked (from gzip encoded content) per the PSR-18 spec:

if a Client chooses to decompress the message body then it MUST also remove the Content-Encoding header and adjust the Content-Length header.

Add (regression) tests as needed.

@mindplay-dk mindplay-dk added bug Something isn't working good first issue Good for newcomers labels Jul 30, 2019
@mindplay-dk
Copy link
Collaborator Author

Hmm, the Content-Length header cannot be added if the message body is going to be unpacked on the fly via stream filters, as it is now:

https://github.com/kodus/http-client/blob/master/src/HttpClient.php#L111

Unless we block while downloading and unpacking the entire stream to a temporary stream - which seems like a pretty poor performance trade-off just for the sake of adding this header.

Can we just omit the Content-Length header rather than adjusting it?

Or is there some header from which the expected decoded content-length can be obtained?

@mindplay-dk mindplay-dk added the help wanted Extra attention is needed label Jul 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant