cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-tracker Archives

[ curl-Bugs-3513010 ] Follow Location: CURLOPT_COOKIE vs CURLOPT_HTTPHEADER

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Fri, 06 Apr 2012 06:32:12 -0700

Bugs item #3513010, was opened at 2012-03-29 16:28
Message generated for change (Settings changed) made by bagder
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=3513010&group_id=976

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: wrong behaviour
>Status: Pending
Resolution: None
Priority: 5
Private: No
Submitted By: swan (buccinator)
Assigned to: Daniel Stenberg (bagder)
Summary: Follow Location: CURLOPT_COOKIE vs CURLOPT_HTTPHEADER

Initial Comment:
Hello, im using PHP 5.3.6-13ubuntu3.6 and curl 7.21.6

hoping someone can confirm if this is happening to others and that it is normal behvaiour;

when a cookie is apended via Set-Cookie it is joined with a comma if the cookies are set via CURLOPT_HTTPHEADER and with a semi-colon if the cookies are set via CURLOPT_COOKIE.

<snip>
HTTP/1.1 302 Found
Date: Thu, 29 Mar 2012 23:10:51 GMT
Server: Apache/2.2.20 (Ubuntu)
X-Powered-By: PHP/5.3.6-13ubuntu3.6
Set-Cookie: cookie_via_server=1333062651
Location: /test/cookie_tester.php?lol=true
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 49
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html

HTTP/1.1 200 OK
Date: Thu, 29 Mar 2012 23:10:51 GMT
Server: Apache/2.2.20 (Ubuntu)
X-Powered-By: PHP/5.3.6-13ubuntu3.6
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 763
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html

array(2) {
  ["cookie_via_server"]=>
  string(10) "1333062651"
  ["cookie_via_CO_COOKIE"]=>
  string(10) "1333062651"
}
array(28) {
  ["HTTP_COOKIE"]=>
  string(61) "cookie_via_server=1333062651; cookie_via_CO_COOKIE=1333062651"
...
</snip>

<snip>
HTTP/1.1 302 Found
Date: Thu, 29 Mar 2012 23:25:23 GMT
Server: Apache/2.2.20 (Ubuntu)
X-Powered-By: PHP/5.3.6-13ubuntu3.6
Set-Cookie: cookie_via_server=1333063523
Location: /test/cookie_tester.php?lol=true
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 55
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html

HTTP/1.1 200 OK
Date: Thu, 29 Mar 2012 23:25:23 GMT
Server: Apache/2.2.20 (Ubuntu)
X-Powered-By: PHP/5.3.6-13ubuntu3.6
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 773
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html

array(1) {
  ["cookie_via_server"]=>
  string(47) "1333063523, cookie_via_CO_HTTPHEADER=1333063523"
}
array(29) {
  ["HTTP_COOKIE"]=>
  string(65) "cookie_via_server=1333063523, cookie_via_CO_HTTPHEADER=1333063523"
...
</snip>

I also noticed that if cookies are set via BOTH CURLOPT_HTPPHEADER and CURLOPT_COOKIE, only the cookies from CURLOPT_HTTPHEADER are considered.

<snip>
HTTP/1.1 302 Found
Date: Thu, 29 Mar 2012 23:26:22 GMT
Server: Apache/2.2.20 (Ubuntu)
X-Powered-By: PHP/5.3.6-13ubuntu3.6
Set-Cookie: cookie_via_server=1333063582
Location: /test/cookie_tester.php?lol=true
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 55
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html

HTTP/1.1 200 OK
Date: Thu, 29 Mar 2012 23:26:22 GMT
Server: Apache/2.2.20 (Ubuntu)
X-Powered-By: PHP/5.3.6-13ubuntu3.6
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 748
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html

array(1) {
  ["cookie_via_server"]=>
  string(47) "1333063582, cookie_via_CO_HTTPHEADER=1333063582"
}
array(28) {
  ["HTTP_COOKIE"]=>
  string(65) "cookie_via_server=1333063582, cookie_via_CO_HTTPHEADER=1333063582"
...
</snip>

----------------------------------------------------------------------

Comment By: Daniel Stenberg (bagder)
Date: 2012-04-03 14:15

Message:
Can you show us your libcurl-using code that repeats the problem please?
and also please tell me which libcurl version and what exactly you're
seeing and what you expected to see.

----------------------------------------------------------------------

Comment By: swan (buccinator)
Date: 2012-04-01 16:12

Message:
sorry i cant replicate the behaviour with the curl binary (time poor and
ignorant).

typically i would submit here first to rule out the actual library, then to
the php wrapper bug tracker; as im question the behaviour aswell as php
wrapper people never seem to reply within a reasonable time period (or at
all).

sending a request via curl with CURLOPT_FOLLOWLOCATIOn and with cookies set
via either CURLOPT_HTTPHEADER or CURLOPT_COOKIE produces differing results
(with the cookies in transit) when the server replies with a Set-Cookie
header.

sorry, i dont know how to say it any more clearer than that including what
ive said previously?

----------------------------------------------------------------------

Comment By: Daniel Stenberg (bagder)
Date: 2012-03-31 10:59

Message:
Sorry, I meant to say that we have a much more *recent* version.

----------------------------------------------------------------------

Comment By: Daniel Stenberg (bagder)
Date: 2012-03-31 10:58

Message:
I'm sorry but I don't know what you're talking about. Can you please attach
a libcurl-using source code that repeats a problem, and can you with that
clearly express what you'd like the program to do and what it instead
does?

Please be aware that A) this project is for the libcurl library and not the
PHP/CURL binding (for which you should contact/report the PHP team for
problems) and B) we have a much more released libcurl version and it would
be very good if you first checked if that version too shows the problem -
if the problem is indeed in libcurl and not in the binding...

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=3513010&group_id=976
Received on 2012-04-06

These mail archives are generated by hypermail.

donate! Page updated January 05, 2012.
web site info

File upload with ASP.NET