Question

If you run this command:

$ curl -XHEAD -i -H "User-Agent: myuseragent" http://www.google.com
HTTP/1.1 302 Found 
... snip ...
Server: gws
Content-Length: 222
X-XSS-Protection: 0

you will notice immediately that the curl command hangs. (I am running this in cygwin/VISTA)

If you run it against twitter or facebook, curl terminates immediately. I suspect it's because twitter & facebook returns Connection: close.

In my Android 1.5 cupcake app, I am running the same command using the HttpClient framework. And I notice that the connection hangs but terminates after the timeout (Thank god for Http 4.0 !! ).

Is there an option to set in HttpClient to terminate once I've received the relevant HEAD http headers?

Was it helpful?

Solution

Have you tried adding the "Connection: close" header to your request? That should tell the server that you don't want a persistent connection.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top