Home » HTTP » HTTP_Request » Bug #8662
Cookies don't get sent if empty url path
Details
| Submitted | 2006-09-08 08:43 UTC |
|---|---|
| From | jarfil at jarfil dot net |
| Assigned | avb |
| Status | Closed |
| Package | HTTP_Request |
| PHP Version | 5.1.6 |
| OS | Linux |
| Roadmaps | (Not assigned) |
Comments
[2006-09-08 08:43 UTC] jarfil at jarfil dot net
Description:
------------
Cookies don't get sent if HTTP_Client->get url has no path section as extracted by Net_URL.
HTTP_Request->setURL
$_url = Net_URL("http://es.groups.yahoo.com");
assert($_url->path == "");
$_url = Net_URL("http://es.groups.yahoo.com/");
assert($_url->path == "/");
HTTP_Client_CookieManager->passCookies
$cookie['path'] = "/";
$_condition = (0 === strpos($url->path, $cookie['path']));
assert( ($url->path == "") && ($_condition == false) ); // <--- BUG
assert( ($url->path == "/") && ($_condition == true) );
Test script:
---------------
$client = new HTTP_Client();
// no cookies
$client->get("http://es.groups.yahoo.com");
// if right user:pass then response sets cookies
$client->post("https://login.yahoo.com/config/login", $fields);
// BUG: cookies don't get sent
$client->get("http://es.groups.yahoo.com");
// FIX: cookies do get sent
$client->get("http://es.groups.yahoo.com/");
Expected result:
----------------
Cookies should be sent in both cases.
[2006-09-08 08:55 UTC] jarfil at jarfil dot net
This seems to fix it:
http://jarfil.info/var/bug/HTTP_Client-1.1.0-bug8662_fix1.diff
[2006-09-22 05:29 UTC] arailean at squiz dot net
Just tested the patch and it seems to solve my cookie issues.