これを使用して、次のこの 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
ドメインで次のことを試してみると、接続が維持され、プログラムが後続の get を実行できなくなります。
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