Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.6.0

Bug #20561 CookieJar compares request host w/ response cookie domain, fails after redirect
Submitted: 2015-06-12 02:37 UTC
From: ncklaus Assigned: avb
Status: Closed Package: HTTP_Request2 (version Unknown)
PHP Version: 5.4.40 OS:
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 17 + 39 = ?

 
 [2015-06-12 02:37 UTC] ncklaus (Klaus Netcreators)
Description: ------------ When I request URLs on youtu.be or t.co, I get Exceptions like "Domain youtu.be cannot set cookies for .youtube.com" and "Domain t.co cannot set cookies for .tinyurl.com" thrown. In \HTTP_Request2_CookieJar::checkAndUpdateFields --> \HTTP_Request2_CookieJar::domainMatch, the host of the original request (e.g. youtu.be) is compared to the cookie domain youtube.com. In e.g. Firebug you can see that the request for youtu.be is replied to with a HTTP 302 and Location: youtube.com. Only the response to the then following request to youtube.com contains a Set-Cookie. The CookieJar should therefore compare the Set-Cookie domain with the host of the last redirect target.

Comments

 [2015-06-30 21:14 UTC] avb (Alexey Borzov)
-Status: Open +Status: Closed -Assigned To: +Assigned To: avb
For the record: the bug was only present in Curl adapter. Fixed in Git: https://github.com/pear/HTTP_Request2/commit/f36670a10bb9586d0e5f9d291f979cb6c8f94bfc CookieJar::addCookiesFromResponse() now uses effective response URL if $setter is not explicitly given, this will prevent further problems with passing incorrect URLs.