0

当我对以下这个 url 执行 HTTP GET 时:

curl -HAccept:text/plain -v http://my-ip-address/myservice

我得到以下输出:

* About to connect() to my-ip-address port 80 (#0)
*   Trying my-ip-address...
* connected
* Connected to my-ip-address (my-ip-address) port 80 (#0)
> GET /myservice HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8x zlib/1.2.5
> Host: my-ip-address
> Accept:text/plain
> 
< HTTP/1.1 200 OK
< Date: Wed, 14 Aug 2013 16:01:29 GMT
< Server: Apache/2.2.25 (Amazon)
< Connection: close
< Transfer-Encoding: chunked
< Content-Type: text/plain; charset=UTF-8
< 
My Output

* Closing connection #0

当我对域尝试以下操作时,连接保持活动状态并且不允许我的程序执行后续获取:

curl -HAccept:text/plain -v http://my-domain.com/myservice


* About to connect() to my-domain port 80 (#0)
*   Trying my-ip...
* connected
* Connected to  (my-ip) port 80 (#0)
> GET /myservice/ HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8x zlib/1.2.5
> Host: my-domain
> Accept:text/plain
> 
< HTTP/1.1 503 Service Unavailable: Back-end server is at capacity
< Content-Length: 0
< Connection: keep-alive
< 
* Connection #0 to host my-domain left intact
* Closing connection #0
4

1 回答 1

0

http 1.1 默认情况下不会关闭,但会保持打开状态以提高速度。

于 2013-11-19T22:55:22.603 回答