cURL / Mailing Lists / curl-library / Single Mail

curl-library

cURL behavior on 303 does not seem to be what is documented/advertised?

From: Yves Arrouye <yarrouye_at_expedia.com>
Date: Tue, 15 Jan 2013 20:51:49 -0800

The man page for cURL documents that if it gets a 303 when sending a POST, it will retry the new location with a GET. However, when it does that, one of the servers I am talking to then complains about the lack of a Content-Length. I am including the output of my command and my command. See the part highlighted between the [[[[LOOK HERE]]]] marks (it's the end of the file): cURL says it abandons POST and does a GET and immediately logs a POST, followed by the server complaining about the lack of length. It seems that cURL did indeed POST here despite what it says?

Can someone clarify the expected behavior and whether this is a bug or not?

Thanks,
YA

$ curl -LsS --data-binary 'foo=bar&lol=3' -X POST -H 'Host: paymentwallet.int-maui.karmalab.net' -k https://paymentwallet.int-maui.karmalab.net –v
* About to connect() to this.hostname.has.been.obfuscat.ed port 443 (#0)
* Trying 67.215.65.132...
* connected
* Connected to this.hostname.has.been.obfuscat.ed (67.215.65.132) port 443 (#0)
* successfully set certificate verify locations:
* CAfile: /opt/local/share/curl/curl-ca-bundle.crt
  CApath: none
* SSLv3, TLS handshake, Client hello (1):
} [data not shown]
* SSLv3, TLS handshake, Server hello (2):
{ [data not shown]
* SSLv3, TLS handshake, CERT (11):
{ [data not shown]
* SSLv3, TLS handshake, Server finished (14):
{ [data not shown]
* SSLv3, TLS handshake, Client key exchange (16):
} [data not shown]
* SSLv3, TLS change cipher, Client hello (1):
} [data not shown]
* SSLv3, TLS handshake, Finished (20):
} [data not shown]
* SSLv3, TLS change cipher, Client hello (1):
{ [data not shown]
* SSLv3, TLS handshake, Finished (20):
{ [data not shown]
* SSL connection using AES256-SHA
* Server certificate:
* subject: serialNumber=UoFmxu6ta5ecJiIs4su2w-q-u8rxJ/d3; OU=GT55236522; OU=See www.rapidssl.com/resources/cps (c)12; OU=Domain Control Validated - RapidSSL(R); CN=*.opendns.com
* start date: 2012-08-23 10:11:50 GMT
* expire date: 2014-09-25 12:42:00 GMT
* issuer: C=US; O=GeoTrust, Inc.; CN=RapidSSL CA
* SSL certificate verify ok.
> POST / HTTP/1.1
> User-Agent: curl/7.28.2-DEV
> Accept: */*
> Host: this.hostname.has.been.obfuscat.ed
> Content-Length: 13
> Content-Type: application/x-www-form-urlencoded
>
} [data not shown]
* upload completely sent off: 13 out of 13 bytes
* HTTP 1.0, assume close after body
< HTTP/1.0 303 See Other
< Location: http://this.hostname.has.been.obfuscat.ed/
< Content-Length: 0
< Connection: close
< Date: Wed, 16 Jan 2013 04:43:41 GMT
< Server: OpenDNS Guide
<
* Closing connection 0
* The cache now contains 0 members
* SSLv3, TLS alert, Client hello (1):
} [data not shown]
* Issue another request to this URL: 'http://this.hostname.has.been.obfuscat.ed/'
[[[[LOOK HERE]]]]
* Disables POST, goes with GET
* About to connect() to this.hostname.has.been.obfuscat.ed port 80 (#1)
* Trying 67.215.65.132...
* connected
* Connected to this.hostname.has.been.obfuscat.ed (67.215.65.132) port 80 (#1)
> POST / HTTP/1.0
> User-Agent: curl/7.28.2-DEV
> Accept: */*
> Host: this.hostname.has.been.obfuscat.ed
>
* HTTP 1.0, assume close after body
< HTTP/1.0 411 Length Required
< Content-Type: text/html
< Content-Length: 357
< Connection: close
< Date: Wed, 16 Jan 2013 04:43:42 GMT
< Server: OpenDNS Guide
<
{ [data not shown]
* Closing connection 1
* The cache now contains 0 members
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
  <title>411 - Length Required</title>
 </head>
 <body>
  <h1>411 - Length Required</h1>
 </body>
</html>
[[[[LOOK HERE]]]]
$

–––
Learn about GPT services and architectures on Confluence.<http://confluence/display/GPT/GPT+Architecture>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-01-16