cURL lost its cookies on different server configurations
Posted: Wed Jun 29, 2011 7:54 am
I have some cURL code that works fine on one server but fails on another. In the debug logs, the only difference I can find is a cookie value that appears on the working server that generates a redirect. The server that fails doesn't post this cookie value. The odd thing is on the working server I don't see a Set-Cookie value setting this cookie up from the host. So there is a bit of magic I don't understand in the curl code on the working server.
Working server:
PHP Version 5.3.3-1ubuntu9.5
Server API Apache 2.0 Handler
cURL Information 7.21.0
Non-working server (shared host):
PHP Version 5.2.17
Server API CGI/FastCGI
cURL Information libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
Working server:
[text]> HEAD /cas/login?service=http%3A%2F%2Fdomain.tld%2Fservice-portal%2Fhome HTTP/1.1
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110422 Ubuntu/10.10 (maverick) Firefox/3.6.17
Host: domain.tld
Referer: http://domain.tld/service-portal/home
Cookie: CASTGC=TGT-2438-tEnfyURvrpDo0BeCoMfGjpB1z34lFvWOyNLpWId2IAAnhsRm3h-cas
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: close
Content-type: text/html, application/x-www-form-urlencoded[/text]
Non-working server:
[text]> HEAD /cas/login?service=http%3A%2F%2Fdomain.tld%2Fservice-portal%2Fhome HTTP/1.1
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110422 Ubuntu/10.10 (maverick) Firefox/3.6.17
Host: domain.tld
Referer: http://domain.tld/service-portal/home
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: close
Content-type: text/html, application/x-www-form-urlencoded[/text]
Can anyone give me some ideas of where to start? (FYI the packets are encrypted). There is something tricky going on with this particular cookie value because the other cookie values work fine on both servers and I see the Set-Cookie values coming from the host for most of the cookies but not all of them. For this cookie, (like a few others) it just seems to appear. I assume there is something happening behind the scenes in curl that isn't being written to the debug file....
EDIT: looking at curl change logs, v 7.15.5 was way back in 2006...christ. What a crappy host.
Working server:
PHP Version 5.3.3-1ubuntu9.5
Server API Apache 2.0 Handler
cURL Information 7.21.0
Non-working server (shared host):
PHP Version 5.2.17
Server API CGI/FastCGI
cURL Information libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
Working server:
[text]> HEAD /cas/login?service=http%3A%2F%2Fdomain.tld%2Fservice-portal%2Fhome HTTP/1.1
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110422 Ubuntu/10.10 (maverick) Firefox/3.6.17
Host: domain.tld
Referer: http://domain.tld/service-portal/home
Cookie: CASTGC=TGT-2438-tEnfyURvrpDo0BeCoMfGjpB1z34lFvWOyNLpWId2IAAnhsRm3h-cas
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: close
Content-type: text/html, application/x-www-form-urlencoded[/text]
Non-working server:
[text]> HEAD /cas/login?service=http%3A%2F%2Fdomain.tld%2Fservice-portal%2Fhome HTTP/1.1
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110422 Ubuntu/10.10 (maverick) Firefox/3.6.17
Host: domain.tld
Referer: http://domain.tld/service-portal/home
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Connection: close
Content-type: text/html, application/x-www-form-urlencoded[/text]
Can anyone give me some ideas of where to start? (FYI the packets are encrypted). There is something tricky going on with this particular cookie value because the other cookie values work fine on both servers and I see the Set-Cookie values coming from the host for most of the cookies but not all of them. For this cookie, (like a few others) it just seems to appear. I assume there is something happening behind the scenes in curl that isn't being written to the debug file....
EDIT: looking at curl change logs, v 7.15.5 was way back in 2006...christ. What a crappy host.