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

keep_alive not response with header Connection: #1393

Closed
july2993 opened this issue Nov 30, 2017 · 4 comments
Closed

keep_alive not response with header Connection: #1393

july2993 opened this issue Nov 30, 2017 · 4 comments

Comments

@july2993
Copy link

with a Http server set keep_alive to true, and use ab (-k to set keep-alive) to test

➜   git:(master) ✗ ab   -k -v 4 -c 1 -n 1 http://127.0.0.1:8080/bar
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)...INFO: GET header ==
---
GET /bar HTTP/1.0
Connection: Keep-Alive
Host: 127.0.0.1:8080
User-Agent: ApacheBench/2.3
Accept: */*


---
LOG: header received:
HTTP/1.1 406 Not Acceptable
Content-Length: 42
Date: Thu, 30 Nov 2017 04:56:01 GMT

{"error": "invalid digit found in string"}
WARNING: Response code not 2xx (406)
apr_pollset_poll: The timeout specified has expired (70007)

ab will hang, because it is expected to receive the Connection header and check it.
i add a connection header myself in the response to address the problem, but i think hyper should better add the header automatically, or it is supposed to be add by youself as expected?
some ref i found: draft-ietf-http-v11-spec

@sfackler
Copy link
Contributor

HTTP/1.1 connections are assumed to be kept alive unless otherwise stated with a Connection: close: https://tools.ietf.org/html/rfc7230#section-6.3.

Why do you think it's trying to read a Connection header? It's already read past the headers into the body, so more headers are definitely not going to be sent.

@sfackler
Copy link
Contributor

Ah, the issue is that ab is sending an HTTP/1.0 request but Hyper's responding with an HTTP/1.1 response. I think this is the same as #1304.

@july2993
Copy link
Author

july2993 commented Dec 1, 2017

thanks for you reply, it's the same as #1304 i even did'n notice that ab send HTTP/1.0 😢 .

@seanmonstar
Copy link
Member

Yep, this is #1304. Closing as duplicate.

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

No branches or pull requests

3 participants