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

Bug #1507 Basic auth in url is not honoured by default
Submitted: 2004-05-26 08:22 UTC Modified: 2006-12-26 23:15 UTC
From: afradejas at mediafusion dot es Assigned: avb
Status: Closed Package: HTTP_Request
PHP Version: 4.3.5 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2004-05-26 08:22 UTC] afradejas at mediafusion dot es
Description: ------------ Description: Current HTTP_Request ignores any auth info present in the URI to request. It's been discarded without notice. package version: HTTP_Request 1.2.2 stable but aplicable in older versions, too. Proposed patch: In function setURL(), right below the Net_URL instantation, add these 3 lines: if ((!empty($this->_url->user)) || (!empty($this->_url->pass))) { $this->setBasicAuth($request->_url->user,$request->_url->pass); } That should be enough. Reproduce code: --------------- script to reproduce the problem: <? include_once("HTTP/Request.php"); $url = "http://user:password@www.example.com/resource"; $request = &new HTTP_Request($url); $request->sendRequest(); ?> The request goes out without the Authorization: header. Expected result: ---------------- An Authorization: Basic xxxxxxxxxxxxxxxxxx should be present in the request sent.

Comments

 [2004-05-26 12:02 UTC] afradejas at mediafusion dot es
Sorry, there was an error in my proposed patch: if ((!empty($this->_url->user)) || (!empty($this->_url->pass))) { $this->setBasicAuth($this->_url->user,$this->_url->pass); } Sorry for my quick copy&paste, I just took it from my local application sources.
 [2004-06-09 09:37 UTC] avb
Thanks, added to CVS.