Hi everybody, I am having a problem using libcurl in my Ruby app (Curb gem binds directly to libcurl). Specifically libcurl can't follow a weird redirect served by a web server. Server Location header "Location: http://www.officedepot.com;jsessionid=0000EXsMRFMF5kwJo26qgOif31d:13ddq0tfm" doesn't look RFC complaint to me. For whatever reason jsessionid gets added to the end of new location. Below is curl command to reproduce the problem and full curl output. Versions tried: 7.19 and 7.21. OS: Ubuntu 10.04 and 11.04. Somehow browsers can handle this redirect. I even tried using browser's user-agent and it has no effect on server response. I just assume browsers are more permissive. libcurl source code in master on github didn't trigger any solutions to me. So here is my question if there is a way to work around this problem?
Thanks a lot in advance for your help, -Alex $ curl -ivL ' http://www.officedepot.com/promo/redir.do?siteid=qpF0HYnRugA-63LcCNNtsuVrjXbS8XCqNA&url=http://www.officedepot.com ' * About to connect() to www.officedepot.com port 80 (#0) * Trying 96.16.174.59... connected * Connected to www.officedepot.com (96.16.174.59) port 80 (#0) > GET /promo/redir.do?siteid=qpF0HYnRugA-63LcCNNtsuVrjXbS8XCqNA&url= http://www.officedepot.com 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.officedepot.com > Accept: */* > < HTTP/1.1 301 Moved Permanently HTTP/1.1 301 Moved Permanently < Server: IBM_HTTP_Server Server: IBM_HTTP_Server < Pragma: No-cache Pragma: No-cache < Cache-Control: no-cache,no-store,max-age=0 Cache-Control: no-cache,no-store,max-age=0 < Expires: Thu, 01 Jan 1970 00:00:00 GMT Expires: Thu, 01 Jan 1970 00:00:00 GMT < Location: http://www.officedepot.com ;jsessionid=0000EXsMRFMF5kwJo26qgOif31d:13ddq0tfm Location: http://www.officedepot.com ;jsessionid=0000EXsMRFMF5kwJo26qgOif31d:13ddq0tfm < Content-Encoding: gzip Content-Encoding: gzip < P3P: CP="ALL DEVa TAIa OUR BUS UNI NAV STA PRE" policyref=" http://www.officedepot.com/w3c/p3p.xml" P3P: CP="ALL DEVa TAIa OUR BUS UNI NAV STA PRE" policyref=" http://www.officedepot.com/w3c/p3p.xml" < Content-Length: 20 Content-Length: 20 < Content-Type: text/html Content-Type: text/html < Content-Language: en-US Content-Language: en-US < Date: Sat, 24 Dec 2011 19:05:44 GMT Date: Sat, 24 Dec 2011 19:05:44 GMT < Connection: keep-alive Connection: keep-alive < Set-Cookie: JSESSIONID=0000EXsMRFMF5kwJo26qgOif31d:13ddq0tfm; Path=/ Set-Cookie: JSESSIONID=0000EXsMRFMF5kwJo26qgOif31d:13ddq0tfm; Path=/ < Set-Cookie: jsession_unique_id=1324753544688; Expires=Sat, 24 Dec 2011 20:35:44 GMT; Path=/ Set-Cookie: jsession_unique_id=1324753544688; Expires=Sat, 24 Dec 2011 20:35:44 GMT; Path=/ < Set-Cookie: CU_BRAND=OD; Expires=Tue, 18 Dec 2012 19:05:44 GMT; Path=/ Set-Cookie: CU_BRAND=OD; Expires=Tue, 18 Dec 2012 19:05:44 GMT; Path=/ < Set-Cookie: IBSD_LOCALE=en_US; Expires=Tue, 18 Dec 2012 19:05:44 GMT; Path=/ Set-Cookie: IBSD_LOCALE=en_US; Expires=Tue, 18 Dec 2012 19:05:44 GMT; Path=/ < Set-Cookie: CID_CART_COOKIE=EXsMRFMF5kwJo26qgOif31d; Expires=Mon, 23 Jan 2012 19:05:44 GMT; Path=/ Set-Cookie: CID_CART_COOKIE=EXsMRFMF5kwJo26qgOif31d; Expires=Mon, 23 Jan 2012 19:05:44 GMT; Path=/ < Set-Cookie: CID_CART_COOKIE=EXsMRFMF5kwJo26qgOif31d; Expires=Mon, 23 Jan 2012 19:05:44 GMT; Path=/ Set-Cookie: CID_CART_COOKIE=EXsMRFMF5kwJo26qgOif31d; Expires=Mon, 23 Jan 2012 19:05:44 GMT; Path=/ < Set-Cookie: CID_CART_COOKIE=EXsMRFMF5kwJo26qgOif31d; Expires=Mon, 23 Jan 2012 19:05:44 GMT; Path=/ Set-Cookie: CID_CART_COOKIE=EXsMRFMF5kwJo26qgOif31d; Expires=Mon, 23 Jan 2012 19:05:44 GMT; Path=/ < Set-Cookie: cookie_abtest_ATC_LIGHTBOX=LIGHTBOX_ENABLED; Expires=Wed, 22 Feb 2012 19:05:44 GMT; Path=/ Set-Cookie: cookie_abtest_ATC_LIGHTBOX=LIGHTBOX_ENABLED; Expires=Wed, 22 Feb 2012 19:05:44 GMT; Path=/ < Set-Cookie: LST=qpF0HYnRugA-63LcCNNtsuVrjXbS8XCqNA; Expires=Mon, 23 Jan 2012 19:05:44 GMT; Path=/ Set-Cookie: LST=qpF0HYnRugA-63LcCNNtsuVrjXbS8XCqNA; Expires=Mon, 23 Jan 2012 19:05:44 GMT; Path=/ < Set-Cookie: LSTime=1324753544720; Expires=Mon, 23 Jan 2012 19:05:44 GMT; Path=/ Set-Cookie: LSTime=1324753544720; Expires=Mon, 23 Jan 2012 19:05:44 GMT; Path=/ < Set-Cookie: cae_browser=desktop; path=/; domain=.officedepot.com Set-Cookie: cae_browser=desktop; path=/; domain=.officedepot.com < * Ignoring the response-body * Connection #0 to host www.officedepot.com left intact * Issue another request to this URL: 'http://www.officedepot.com ;jsessionid=0000EXsMRFMF5kwJo26qgOif31d:13ddq0tfm' * getaddrinfo(3) failed for www.officedepot.com ;jsessionid=0000EXsMRFMF5kwJo26qgOif31d:13ddq0tfm:80 * Couldn't resolve host 'www.officedepot.com ;jsessionid=0000EXsMRFMF5kwJo26qgOif31d:13ddq0tfm' * Closing connection #1 curl: (6) Couldn't resolve host 'www.officedepot.com ;jsessionid=0000EXsMRFMF5kwJo26qgOif31d:13ddq0tfm' * Closing connection #0
------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
