cURL / Mailing Lists / curl-library / Single Mail

curl-library

Cooke is not sent when url in location header has a port

From: Alex Vinnik <alvinnik.g_at_gmail.com>
Date: Tue, 27 Dec 2011 17:18:19 -0600

Hi everybody,

Here is interesting case I run into with libcurl on ubuntu. Tried 7.19 and
7.24

Run this command
curl -ivL http://www.kqzyfj.com/click-0-10577325

libcurl gets into infinite loop of redirects from server and stops reaching
limit of 50 redirects.

Try the same ulr with in Chrome and it will work. Think I figure out what
is the problem... Check log line #84. Server redirect to original url, adds
port :80 to host plus provides cookes that should be returned back when
http://www.cengagebrain.com:80 accessed. But it doesn't happen in case of
libcurl. See line #96. As a result server sends redirect again, libcurl
sends no cookes and cycle repeats. Somehow chrome figures out that
http://www.cengagebrain.com:80/shop/index.html?cid=CJ2 and
http://www.cengagebrain.com/shop/index.html?cid=CJ2 are the same urls and
sends needed cookies and given a new resource. Does it sound like a bug?
Please let me know if there is a way around it.

 1 * About to connect() to www.kqzyfj.com port 80 (#0)
  2 * Trying 216.34.207.62... connected
  3 * Connected to www.kqzyfj.com (216.34.207.62) port 80 (#0)
  4 > GET /click-0-10577325 HTTP/1.1^M
  5 > 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^M
  6 > Host: www.kqzyfj.com^M
  7 > Accept: */*^M
  8 > ^M
  9 < HTTP/1.1 302 Found^M
 10 < Server: Resin/3.1.8^M
 11 < P3P: policyref="http://www.kqzyfj.com/w3c/p3p.xml", CP="ALL BUS LEG
DSP COR ADM CUR DEV PSA OUR NAV INT"^M
 12 < Cache-control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0^M
 13 < Pragma: no-cache^M
 14 < Expires: Tue, 27 Dec 2011 22:09:40 GMT^M
 15 < Location: http://www.apmebf.com/hj115vpyxF/pw0/EDIKKGFI/D/D/D/D?o=n
<<r33z%3A%2F%2F666.u098pt.myw%3AIA%2Fmvsmu-A-BAFHHDCF<<Q<<^M
 16 < Content-Type: text/html^M
 17 < Connection: close^M
 18 < Transfer-Encoding: chunked^M
 19 < Date: Tue, 27 Dec 2011 22:09:40 GMT^M
 20 < ^M
 21 * Closing connection #0
 22 * Issue another request to this URL: '
http://www.apmebf.com/hj115vpyxF/pw0/EDIKKGFI/D/D/D/D?o=n
<<r33z%3A%2F%2F666.u098pt.myw%3AIA%2Fmvsmu-A-BAFHHDCF<<Q<<'
 23 * About to connect() to www.apmebf.com port 80 (#0)
 24 * Trying 216.34.207.59... connected
 25 * Connected to www.apmebf.com (216.34.207.59) port 80 (#0)
 26 > GET
/hj115vpyxF/pw0/EDIKKGFI/D/D/D/D?o=n<<r33z%3A%2F%2F666.u098pt.myw%3AIA%2Fmvsmu-A-BAFHHDCF<<Q<<
HTTP/1.1^M
 27 > 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^M
 28 > Host: www.apmebf.com^M
 29 > Accept: */*^M
 30 > ^M
 31 < HTTP/1.1 302 Found^M
 32 < Server: Resin/3.1.8^M
 33 < P3P: policyref="http://www.apmebf.com/w3c/p3p.xml", CP="ALL BUS LEG
DSP COR ADM CUR DEV PSA OUR NAV INT"^M
 34 < Cache-control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0^M
 35 < Pragma: no-cache^M
 36 < Expires: Tue, 27 Dec 2011 22:09:40 GMT^M
 37 < Location:
http://www.emjcd.com/8n70vpyxH/pw0/EDIKKGFI/D/D/r86p9D8CELGLDEJIEMCEGFIDFGKLDILLCFw/KMEqJFMIGDqKEErELFLIDDFGnrssDKEr?x=w<krw!4E2i-0o5mGm8<p11x%3A%2F%2F444.sy76nr.
    kwu%3AG8%2Fktqks-8-98DFFBAD<<O<<^M
 38 < Set-Cookie: S=ewucx0w-1838016519-1325023780588-2j; domain=.apmebf.com;
path=/; expires=Sun, 25-Dec-2016 22:09:40 GMT^M
 39 < Set-Cookie: LCLK=cjo!w6ua-sgxe8e0; domain=.apmebf.com; path=/;
expires=Sun, 25-Dec-2016 22:09:40 GMT^M
 40 < Content-Type: text/html^M
 41 < Connection: close^M
 42 < Transfer-Encoding: chunked^M
 43 < Date: Tue, 27 Dec 2011 22:09:40 GMT^M
 44 < ^M
 45 * Closing connection #0
 46 * Issue another request to this URL: '
http://www.emjcd.com/8n70vpyxH/pw0/EDIKKGFI/D/D/r86p9D8CELGLDEJIEMCEGFIDFGKLDILLCFw/KMEqJFMIGDqKEErELFLIDDFGnrssDKEr?x=w<krw!4E2i-
          0o5mGm8<p11x%3A%2F%2F444.sy76nr.kwu%3AG8%2Fktqks-8-98DFFBAD<<O<<'
 47 * About to connect() to www.emjcd.com port 80 (#0)
 48 * Trying 216.34.207.62... connected
 49 * Connected to www.emjcd.com (216.34.207.62) port 80 (#0)
 50 > GET
/8n70vpyxH/pw0/EDIKKGFI/D/D/r86p9D8CELGLDEJIEMCEGFIDFGKLDILLCFw/KMEqJFMIGDqKEErELFLIDDFGnrssDKEr?x=w<krw!4E2i-0o5mGm8<p11x%3A%2F%2F444.sy76nr.kwu%3AG8%2Fktqks-8-
           98DFFBAD<<O<< HTTP/1.1^M
 51 > 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^M
 52 > Host: www.emjcd.com^M
 53 > Accept: */*^M
54 > ^M
 55 < HTTP/1.1 302 Found^M
 56 < Server: Resin/3.1.8^M
 57 < P3P: policyref="http://www.emjcd.com/w3c/p3p.xml", CP="ALL BUS LEG
DSP COR ADM CUR DEV PSA OUR NAV INT"^M
 58 < Cache-control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0^M
 59 < Pragma: no-cache^M
 60 < Expires: Tue, 27 Dec 2011 22:09:40 GMT^M
 61 < Location: http://www.cengagebrain.com/shop/index.html?cid=CJ2^M
 62 < Set-Cookie: LCLK=cjo!w6ua-sgxe8e0; domain=.emjcd.com; path=/;
expires=Sun, 25-Dec-2016 22:09:40 GMT^M
 63 < Set-Cookie: S=ewucx0w-1838016519-1325023780588-2j; domain=.emjcd.com;
path=/; expires=Sun, 25-Dec-2016 22:09:40 GMT^M
 64 < Content-Type: text/html^M
 65 < Connection: close^M
 66 < Transfer-Encoding: chunked^M
 67 < Date: Tue, 27 Dec 2011 22:09:40 GMT^M
 68 < ^M
 69 * Closing connection #0
 70 * Issue another request to this URL: '
http://www.cengagebrain.com/shop/index.html?cid=CJ2'
 71 * About to connect() to www.cengagebrain.com port 80 (#0)
 72 * Trying 69.32.132.209... connected
 73 * Connected to www.cengagebrain.com (69.32.132.209) port 80 (#0)
 74 > GET /shop/index.html?cid=CJ2 HTTP/1.1^M
 75 > 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^M
 76 > Host: www.cengagebrain.com^M
 77 > Accept: */*^M
 78 > ^M
 79 < HTTP/1.1 302 Moved Temporarily^M
 80 < Date: Tue, 27 Dec 2011 22:09:41 GMT^M
 81 < Server: Apache/2.2.20 (Unix) mod_ssl/2.2.20 OpenSSL/0.9.8r^M
 82 < Cache-Control: no-cache="set-cookie"^M
 83 < X-Cnection: close^M
 84 < Location: http://www.cengagebrain.com:80/shop/index.html?cid=CJ2^M
 85 < Set-Cookie: commerceRegion=US; domain=cengagebrain.com; path=/^M
 86 < Set-Cookie: oidRegion=USA; domain=cengagebrain.com; path=/^M
 87 < Set-Cookie:
CMGTJSESSIONID=yV1ST6CFvp57QrjWKTWhRdKhsKLBRKD8Hxp5bRbDx1jcnMGCcHt7!206301317!-637730859;
path=/^M
 88 < X-Powered-By: Servlet/2.5 JSP/2.1^M
 89 < Set-Cookie: BIGipServerecom-p-cmgt-8093-pool01=1375510538.40223.0000;
path=/^M
 90 < Vary: Accept-Encoding^M
 91 < Transfer-Encoding: chunked^M
 92 < Content-Type: text/html^M
 93 < ^M
 94 * Ignoring the response-body
 95 { [data not shown]
 96 * Connection #0 to host www.cengagebrain.com left intact
 97 * Issue another request to this URL: '
http://www.cengagebrain.com:80/shop/index.html?cid=CJ2'
 98 * Re-using existing connection! (#0) with host www.cengagebrain.com
 99 * Connected to www.cengagebrain.com (69.32.132.209) port 80 (#0)
100 > GET /shop/index.html?cid=CJ2 HTTP/1.1^M
101 > 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^M
102 > Host: www.cengagebrain.com^M
103 > Accept: */*^M
104 > ^M
105 < HTTP/1.1 302 Moved Temporarily^M
106 < Date: Tue, 27 Dec 2011 22:09:41 GMT^M
107 < Server: Apache/2.2.20 (Unix) mod_ssl/2.2.20 OpenSSL/0.9.8r^M
108 < Cache-Control: no-cache="set-cookie"^M
109 < X-Cnection: close^M
110 < Location: http://www.cengagebrain.com:80/shop/index.html?cid=CJ2^M
111 < Set-Cookie: commerceRegion=US; domain=cengagebrain.com; path=/^M
112 < Set-Cookie: oidRegion=USA; domain=cengagebrain.com; path=/^M
113 < Set-Cookie:
CMGTJSESSIONID=fqGhT6CFPs96zLxpLkLNYqm2QTK7YJdHypT0L7B41xXT1nGQ88Qh!-637730859!10503717;
path=/^M
114 < X-Powered-By: Servlet/2.5 JSP/2.1^M
115 < Set-Cookie: BIGipServerecom-p-cmgt-8093-pool01=1392287754.40223.0000;
path=/^M
116 < Vary: Accept-Encoding^M
117 < Transfer-Encoding: chunked^M
118 < Content-Type: text/html^M
119 < ^M
120 * Ignoring the response-body
121 { [data not shown]
122 * Connection #0 to host www.cengagebrain.com left intact
123 * Issue another request to this URL: '
http://www.cengagebrain.com:80/shop/index.html?cid=CJ2'
124 * Re-using existing connection! (#0) with host www.cengagebrain.com
125 * Connected to www.cengagebrain.com (69.32.132.209) port 80 (#0)
126 > GET /shop/index.html?cid=CJ2 HTTP/1.1^M
127 > 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^M
128 > Host: www.cengagebrain.com^M
129 > Accept: */*^M
130 > ^M
131 < HTTP/1.1 302 Moved Temporarily^M
132 < Date: Tue, 27 Dec 2011 22:09:41 GMT^M
133 < Server: Apache/2.2.20 (Unix) mod_ssl/2.2.20 OpenSSL/0.9.8r^M
134 < Cache-Control: no-cache="set-cookie"^M
135 < X-Cnection: close^M
136 < Location: http://www.cengagebrain.com:80/shop/index.html?cid=CJ2^M
137 < Set-Cookie: commerceRegion=US; domain=cengagebrain.com; path=/^M
138 < Set-Cookie: oidRegion=USA; domain=cengagebrain.com; path=/^M
139 < Set-Cookie:
CMGTJSESSIONID=svFyT6CFLR92n1TTvrXMvFBZpvjzFK06wMDl09ZpLtDhhpP5p72k!-1112072791!-416415434;
path=/^M
140 < X-Powered-By: Servlet/2.5 JSP/2.1^M
141 < Set-Cookie: BIGipServerecom-p-cmgt-8093-pool01=1341956106.40223.0000;
path=/^M
142 < Vary: Accept-Encoding^M
143 < Transfer-Encoding: chunked^M
144 < Content-Type: text/html^M
145 < ^M
146 * Ignoring the response-body
147 { [data not shown]
148 * Connection #0 to host www.cengagebrain.com left intact
149 * Maximum (5) redirects followed
150 curl: (47) Maximum (5) redirects followed
151 * Closing connection #0

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-12-28