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 13:22 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  
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 : 3 + 38 = ?

 
 [2004-05-26 13: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 17: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 14:37 UTC] avb
Thanks, added to CVS.