curl-library
curl gets into infinite redirect loop
Date: Wed, 28 Dec 2011 11:59:27 -0600
Hi everybody,
Unearthed one more interesting redirect case at least for me :) ... curl
gets into infinite redirect loop with a website and exists after hitting
redirect limit.
Here is how to reproduce it. Verbose libcurl output is below
curl -ivL http://www.kqzyfj.com/click-0-10721226
In a nutshell... It is clear that one of the early re-directors provides
mixed case Location url http://www.UltraFragrances.com/ which is not
correct. However libcurl connects to the server just to get redirect to the
same but all lower case location http://www.ultrafragrances.com/. Looks
good so far with the exception that libcurl reuses already existing
connection to www.UltraFragrances.com and keeps sending Host:
www.UltraFragrances.com cached in existing connections table. It obviously
creates that infinitude request-response loop with the
server. Tried --no-keepalive option but it didn't work because use
of existing connection is forced in case a follow.
As usual Chrome just handles it fine by converting first incorrect mixed
case Location url to all lower case. Any workaround for this case? Please
help. Thanks. -Alex
curl --max-redirs 5 -ivL http://www.kqzyfj.com/click-0-10721226
* About to connect() to www.kqzyfj.com port 80 (#0)
* Trying 216.34.207.62... connected
* Connected to www.kqzyfj.com (216.34.207.62) port 80 (#0)
> GET /click-0-10721226 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.kqzyfj.com
> Accept: */*
>
< HTTP/1.1 302 Found
HTTP/1.1 302 Found
< Server: Resin/3.1.8
Server: Resin/3.1.8
< P3P: policyref="http://www.kqzyfj.com/w3c/p3p.xml", CP="ALL BUS LEG DSP
COR ADM CUR DEV PSA OUR NAV INT"
P3P: policyref="http://www.kqzyfj.com/w3c/p3p.xml", CP="ALL BUS LEG DSP COR
ADM CUR DEV PSA OUR NAV INT"
< Cache-control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
Cache-control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
< Pragma: no-cache
Pragma: no-cache
< Expires: Wed, 28 Dec 2011 17:43:33 GMT
Expires: Wed, 28 Dec 2011 17:43:33 GMT
< Location: http://www.apmebf.com/9f104iqzyG/qx1/FELGFGGK/E/E/E/E?w=q
<<lxxt%3A%2F%2F000.ou32jn.gsq%3AC4%2Fgpmgo-4-54B6566A<<K<<
Location: http://www.apmebf.com/9f104iqzyG/qx1/FELGFGGK/E/E/E/E?w=q
<<lxxt%3A%2F%2F000.ou32jn.gsq%3AC4%2Fgpmgo-4-54B6566A<<K<<
< Content-Type: text/html
Content-Type: text/html
< Connection: close
Connection: close
< Transfer-Encoding: chunked
Transfer-Encoding: chunked
< Date: Wed, 28 Dec 2011 17:43:33 GMT
Date: Wed, 28 Dec 2011 17:43:33 GMT
<
* Closing connection #0
* Issue another request to this URL: '
http://www.apmebf.com/9f104iqzyG/qx1/FELGFGGK/E/E/E/E?w=q
<<lxxt%3A%2F%2F000.ou32jn.gsq%3AC4%2Fgpmgo-4-54B6566A<<K<<'
* About to connect() to www.apmebf.com port 80 (#0)
* Trying 216.34.207.59... connected
* Connected to www.apmebf.com (216.34.207.59) port 80 (#0)
> GET
/9f104iqzyG/qx1/FELGFGGK/E/E/E/E?w=q<<lxxt%3A%2F%2F000.ou32jn.gsq%3AC4%2Fgpmgo-4-54B6566A<<K<<
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.apmebf.com
> Accept: */*
>
< HTTP/1.1 302 Found
HTTP/1.1 302 Found
< Server: Resin/3.1.8
Server: Resin/3.1.8
< P3P: policyref="http://www.apmebf.com/w3c/p3p.xml", CP="ALL BUS LEG DSP
COR ADM CUR DEV PSA OUR NAV INT"
P3P: policyref="http://www.apmebf.com/w3c/p3p.xml", CP="ALL BUS LEG DSP COR
ADM CUR DEV PSA OUR NAV INT"
< Cache-control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
Cache-control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
< Pragma: no-cache
Pragma: no-cache
< Expires: Wed, 28 Dec 2011 17:43:33 GMT
Expires: Wed, 28 Dec 2011 17:43:33 GMT
< Location:
http://www.emjcd.com/mc104wktsC/krw/98FA9AAE/8/8/9yCAj9-79G8DGA89FF79BAD8HCA9BFG87w2/FEH9ECGBB9Fj99m9GBAB88ACmGEln9E9?d=m
<u16!Ey9F-yJxQzC8<zBB7%3A%2F%2FEEE.28HGx1.u64%3AQI%2Fu30u2-I-JIPKJKKO<<Y<<
Location:
http://www.emjcd.com/mc104wktsC/krw/98FA9AAE/8/8/9yCAj9-79G8DGA89FF79BAD8HCA9BFG87w2/FEH9ECGBB9Fj99m9GBAB88ACmGEln9E9?d=m
<u16!Ey9F-yJxQzC8<zBB7%3A%2F%2FEEE.28HGx1.u64%3AQI%2Fu30u2-I-JIPKJKKO<<Y<<
< Set-Cookie: S=1q42b1s-1805820177-1325094213780-ov; domain=.apmebf.com;
path=/; expires=Mon, 26-Dec-2016 17:43:33 GMT
Set-Cookie: S=1q42b1s-1805820177-1325094213780-ov; domain=.apmebf.com;
path=/; expires=Mon, 26-Dec-2016 17:43:33 GMT
< Set-Cookie: LCLK=cjo!wgrx-g1f8huq; domain=.apmebf.com; path=/;
expires=Mon, 26-Dec-2016 17:43:33 GMT
Set-Cookie: LCLK=cjo!wgrx-g1f8huq; domain=.apmebf.com; path=/; expires=Mon,
26-Dec-2016 17:43:33 GMT
< Content-Type: text/html
Content-Type: text/html
< Connection: close
Connection: close
< Transfer-Encoding: chunked
Transfer-Encoding: chunked
< Date: Wed, 28 Dec 2011 17:43:33 GMT
Date: Wed, 28 Dec 2011 17:43:33 GMT
<
* Closing connection #0
* Issue another request to this URL: '
http://www.emjcd.com/mc104wktsC/krw/98FA9AAE/8/8/9yCAj9-79G8DGA89FF79BAD8HCA9BFG87w2/FEH9ECGBB9Fj99m9GBAB88ACmGEln9E9?d=m
<u16!Ey9F-yJxQzC8<zBB7%3A%2F%2FEEE.28HGx1.u64%3AQI%2Fu30u2-I-JIPKJKKO<<Y<<'
* About to connect() to www.emjcd.com port 80 (#0)
* Trying 216.34.207.62... connected
* Connected to www.emjcd.com (216.34.207.62) port 80 (#0)
> GET
/mc104wktsC/krw/98FA9AAE/8/8/9yCAj9-79G8DGA89FF79BAD8HCA9BFG87w2/FEH9ECGBB9Fj99m9GBAB88ACmGEln9E9?d=m<u16!Ey9F-yJxQzC8<zBB7%3A%2F%2FEEE.28HGx1.u64%3AQI%2Fu30u2-I-JIPKJKKO<<Y<<
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.emjcd.com
> Accept: */*
>
< HTTP/1.1 302 Found
HTTP/1.1 302 Found
< Server: Resin/3.1.8
Server: Resin/3.1.8
< P3P: policyref="http://www.emjcd.com/w3c/p3p.xml", CP="ALL BUS LEG DSP
COR ADM CUR DEV PSA OUR NAV INT"
P3P: policyref="http://www.emjcd.com/w3c/p3p.xml", CP="ALL BUS LEG DSP COR
ADM CUR DEV PSA OUR NAV INT"
< Cache-control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
Cache-control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
< Pragma: no-cache
Pragma: no-cache
< Expires: Wed, 28 Dec 2011 17:43:33 GMT
Expires: Wed, 28 Dec 2011 17:43:33 GMT
< Location: http://www.UltraFragrances.com/
Location: http://www.UltraFragrances.com/
< Set-Cookie: LCLK=cjo!wgrx-g1f8huq; domain=.emjcd.com; path=/;
expires=Mon, 26-Dec-2016 17:43:33 GMT
Set-Cookie: LCLK=cjo!wgrx-g1f8huq; domain=.emjcd.com; path=/; expires=Mon,
26-Dec-2016 17:43:33 GMT
< Set-Cookie: S=1q42b1s-1805820177-1325094213780-ov; domain=.emjcd.com;
path=/; expires=Mon, 26-Dec-2016 17:43:33 GMT
Set-Cookie: S=1q42b1s-1805820177-1325094213780-ov; domain=.emjcd.com;
path=/; expires=Mon, 26-Dec-2016 17:43:33 GMT
< Content-Type: text/html
Content-Type: text/html
< Connection: close
Connection: close
< Transfer-Encoding: chunked
Transfer-Encoding: chunked
< Date: Wed, 28 Dec 2011 17:43:33 GMT
Date: Wed, 28 Dec 2011 17:43:33 GMT
<
* Closing connection #0
* Issue another request to this URL: 'http://www.UltraFragrances.com/'
* About to connect() to www.UltraFragrances.com port 80 (#0)
* Trying 184.172.217.168... connected
* Connected to www.UltraFragrances.com (184.172.217.168) port 80 (#0)
> GET / 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.UltraFragrances.com
> Accept: */*
>
< HTTP/1.1 302 Moved Temporarily
HTTP/1.1 302 Moved Temporarily
< Date: Wed, 28 Dec 2011 17:43:31 GMT
Date: Wed, 28 Dec 2011 17:43:31 GMT
< Server: Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8m DAV/2
mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
Server: Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8m DAV/2
mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
< X-Powered-By: PHP/5.2.16
X-Powered-By: PHP/5.2.16
< Location: http://www.ultrafragrances.com/
Location: http://www.ultrafragrances.com/
< Content-Length: 0
Content-Length: 0
< Content-Type: text/html; charset=UTF-8
Content-Type: text/html; charset=UTF-8
<
* Connection #0 to host www.UltraFragrances.com left intact
* Issue another request to this URL: 'http://www.ultrafragrances.com/'
* Re-using existing connection! (#0) with host www.UltraFragrances.com
* Connected to www.UltraFragrances.com (184.172.217.168) port 80 (#0)
> GET / 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.UltraFragrances.com
> Accept: */*
>
< HTTP/1.1 302 Moved Temporarily
HTTP/1.1 302 Moved Temporarily
< Date: Wed, 28 Dec 2011 17:43:31 GMT
Date: Wed, 28 Dec 2011 17:43:31 GMT
< Server: Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8m DAV/2
mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
Server: Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8m DAV/2
mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
< X-Powered-By: PHP/5.2.16
X-Powered-By: PHP/5.2.16
< Location: http://www.ultrafragrances.com/
Location: http://www.ultrafragrances.com/
< Content-Length: 0
Content-Length: 0
< Content-Type: text/html; charset=UTF-8
Content-Type: text/html; charset=UTF-8
<
* Connection #0 to host www.UltraFragrances.com left intact
* Issue another request to this URL: 'http://www.ultrafragrances.com/'
* Re-using existing connection! (#0) with host www.UltraFragrances.com
* Connected to www.UltraFragrances.com (184.172.217.168) port 80 (#0)
> GET / 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.UltraFragrances.com
> Accept: */*
>
< HTTP/1.1 302 Moved Temporarily
HTTP/1.1 302 Moved Temporarily
< Date: Wed, 28 Dec 2011 17:43:31 GMT
Date: Wed, 28 Dec 2011 17:43:31 GMT
< Server: Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8m DAV/2
mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
Server: Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8m DAV/2
mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635
< X-Powered-By: PHP/5.2.16
X-Powered-By: PHP/5.2.16
< Location: http://www.ultrafragrances.com/
Location: http://www.ultrafragrances.com/
< Content-Length: 0
Content-Length: 0
< Content-Type: text/html; charset=UTF-8
Content-Type: text/html; charset=UTF-8
<
* Connection #0 to host www.UltraFragrances.com left intact
* Maximum (5) redirects followed
curl: (47) Maximum (5) redirects followed
* 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