cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker Archives

[curl:bugs] #1176 Inconsistent responses: -I vs -X HEAD

From: Daniel Stenberg <bagder_at_users.sf.net>
Date: Fri, 21 Dec 2012 12:37:26 +0000

Thanks for your report.

This bug report does seem to be based on a misunderstanding of what -X does and how it works. "-X HEAD" is *no way* meant to be the same as -I. All -X does (for HTTP) is to change the method keyword, and in all other aspects it will work as if the original method was used. So -X HEAD will act as if GET was sent, but it will send a HEAD and subsequently the handling of the response headers are different.

If there's a bug here, it would be the manual section for -X that could be improved to make this easier to understand.

---
** [bugs:#1176] Inconsistent responses: -I vs -X HEAD**
**Status:** pending-invalid
**Created:** Fri Dec 21, 2012 02:49 AM UTC by Mark Van de Vyver
**Last Updated:** Fri Dec 21, 2012 02:49 AM UTC
**Owner:** Daniel Stenberg
Attached are wireshark captures of each of the following requests.
Using:
    #!/usr/bin/env bash
    $ curl -V
    curl 7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15
    Protocols: tftp ftp telnet dict ldap ldaps http file https ftps 
    Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz 
On
    #!/usr/bin/env bash
    $ lsb_release -a
    No LSB modules are available.
    Distributor ID:	Ubuntu
    Description:	Ubuntu 10.04.4 LTS
    Release:	10.04
    Codename:	lucid
The following HEAD request hangs for some time, then returns without having read the data:
    #!/usr/bin/env bash
    $ curl -vvvv -X HEAD http://www.cookbooks.io/oc-mysql.json
    * About to connect() to www.cookbooks.io port 80 (#0)
    *   Trying 54.240.176.48... connected
    * Connected to www.cookbooks.io (54.240.176.48) port 80 (#0)
    > HEAD /oc-mysql.json HTTP/1.1
    > User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15
    > Host: www.cookbooks.io
    > Accept: */*
    > 
    * HTTP 1.0, assume close after body
    < HTTP/1.0 200 OK
    < Content-Type: application/json
    < Content-Length: 397
    * HTTP/1.0 connection set to keep alive!
    < Connection: keep-alive
    < x-amz-id-2: kg0Abj7a82VnHeFwXxNGIQKStQH7hGKS1h04Sugecn2EACjHmGI6nEYmyeetcLUo
    < x-amz-request-id: 174E29993AA95268
    < Date: Wed, 19 Dec 2012 09:34:16 GMT
    < Last-Modified: Sat, 08 Dec 2012 10:36:44 GMT
    < ETag: "a6765239cf5298eb9ace2df4bef09ff7"
    < Server: AmazonS3
    < Age: 17551
    < X-Amz-Cf-Id: vthKMA0DpoemDPBvIa9Y4Vkr2ctDdvpyMPEXJQhcNKJFaWV7rYtKew==
    < Via: 1.0 80c5b2b8de9b2bf3715181e52314a46c.cloudfront.net (CloudFront)
    < X-Cache: Hit from cloudfront
    < 
    * transfer closed with 397 bytes remaining to read
    * Closing connection #0
    curl: (18) transfer closed with 397 bytes remaining to read
The following HEAD request returns immediately, as expected
    #!/usr/bin/env bash
    $ curl -vvvv -I http://www.cookbooks.io/oc-mysql.json
    * About to connect() to www.cookbooks.io port 80 (#0)
    *   Trying 54.240.176.10... connected
    * Connected to www.cookbooks.io (54.240.176.10) port 80 (#0)
    > HEAD /oc-mysql.json HTTP/1.1
    > User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15
    > Host: www.cookbooks.io
    > Accept: */*
    > 
    * HTTP 1.0, assume close after body
    < HTTP/1.0 200 OK
    HTTP/1.0 200 OK
    < Content-Type: application/json
    Content-Type: application/json
    < Content-Length: 397
    Content-Length: 397
    * HTTP/1.0 connection set to keep alive!
    < Connection: keep-alive
    Connection: keep-alive
    < x-amz-id-2: kg0Abj7a82VnHeFwXxNGIQKStQH7hGKS1h04Sugecn2EACjHmGI6nEYmyeetcLUo
    x-amz-id-2: kg0Abj7a82VnHeFwXxNGIQKStQH7hGKS1h04Sugecn2EACjHmGI6nEYmyeetcLUo
    < x-amz-request-id: 174E29993AA95268
    x-amz-request-id: 174E29993AA95268
    < Date: Wed, 19 Dec 2012 09:34:16 GMT
    Date: Wed, 19 Dec 2012 09:34:16 GMT
    < Last-Modified: Sat, 08 Dec 2012 10:36:44 GMT
    Last-Modified: Sat, 08 Dec 2012 10:36:44 GMT
    < ETag: "a6765239cf5298eb9ace2df4bef09ff7"
    ETag: "a6765239cf5298eb9ace2df4bef09ff7"
    < Server: AmazonS3
    Server: AmazonS3
    < Age: 17498
    Age: 17498
    < X-Amz-Cf-Id: WDFkBSbsqHlTHfyCxJlwSpPZmWjlUbWBYifj2_5WK9LBEnwnMwEkpg==
    X-Amz-Cf-Id: WDFkBSbsqHlTHfyCxJlwSpPZmWjlUbWBYifj2_5WK9LBEnwnMwEkpg==
    < Via: 1.0 af6d631f98f136eb1062d3234862f44d.cloudfront.net (CloudFront)
    Via: 1.0 af6d631f98f136eb1062d3234862f44d.cloudfront.net (CloudFront)
    < X-Cache: Hit from cloudfront
    X-Cache: Hit from cloudfront
    
    < 
    * Connection #0 to host www.cookbooks.io left intact
    * Closing connection #0
    
---
Sent from sourceforge.net because you indicated interest in <https://sourceforge.net/p/curl/bugs/1176/>
To unsubscribe from further messages, please visit <https://sourceforge.net/auth/prefs/>
Received on 2012-12-21

These mail archives are generated by hypermail.

donate! Page updated January 05, 2012.
web site info

File upload with ASP.NET