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

Misbehavior in the presence of HTTP 103 early hints #521

Closed
thomasjm opened this issue Nov 22, 2023 · 1 comment
Closed

Misbehavior in the presence of HTTP 103 early hints #521

thomasjm opened this issue Nov 22, 2023 · 1 comment

Comments

@thomasjm
Copy link
Contributor

Initially I filed fpco/http-reverse-proxy#44, but then I decided to test if http-client itself works properly in the presence of HTTP 103 early hints, and it seems it does not.

I added another repro alongside my existing one, so you can check it as follows. The meat of it is here.

cd $(mktemp -d)
git clone [email protected]:codedownio/http-reverse-proxy.git --branch http-103-early-hints-repro
npm install && npm run start # Starts a test Node.js server

# Now switch to the same folder in another terminal and do
stack run client-test

This will use http-client to make a normal request, as well as an early-hints request.

Normal request output

Doing an HTTP request to http://localhost:3005/simple
The status code was: 200
Full response: Response {responseStatus = Status {statusCode = 200, statusMessage = "OK"}, responseVersion = HTTP/1.1, responseHeaders = [("X-Powered-By","Express"),("Content-Type","text/html; charset=utf-8"),("Content-Length","16"),("ETag","W/\"10-uViC3pa4b5/U2h5JkCXIHUyMvk0\""),("Date","Wed, 22 Nov 2023 07:25:23 GMT"),("Connection","keep-alive"),("Keep-Alive","timeout=5")], responseBody = "Simple response!", responseCookieJar = CJ {expose = []}, responseClose' = ResponseClose}
"Simple response!"

Early hints request output

Doing an HTTP request to http://localhost:3005/early_hints
The status code was: 103
Full response: Response {responseStatus = Status {statusCode = 103, statusMessage = "Early Hints"}, responseVersion = HTTP/1.1, responseHeaders = [("Link","</some-file.js>")], responseBody = "", responseCookieJar = CJ {expose = []}, responseClose' = ResponseClose}
""

It seems that http-client sees the HTTP 103 status line and thinks it's at the end of the request. It gets the headers, but doesn't proceed to get the final status code or the response body.

@thomasjm
Copy link
Contributor Author

thomasjm commented Jan 7, 2024

Resolved by #524.

@thomasjm thomasjm closed this as completed Jan 7, 2024
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 a pull request may close this issue.

1 participant