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

Bug #12954 Host header missing when using proxy
Submitted: 2008-01-22 02:27 UTC
From: flint Assigned: flint
Status: Closed Package: PEAR (version 1.6.2)
PHP Version: Irrelevant OS:
Roadmaps: 1.7.0    

 [2008-01-22 02:27 UTC] flint (Matthew Flint)
Description: ------------ The Downloader.php script omits the "Host" HTTP header when a proxy is set. This violates the HTTP 1.1 protocol, and results in 400 Bad Request errors: # pear update-channels Updating channel "" Cannot retrieve channel.xml for channel "" (File not valid (received: HTTP/1.1 400 Bad Request ))


 [2008-01-29 03:49 UTC] cellog (Greg Beaver)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. the patch should be against PEAR/REST.php, PEAR_Downloader has had this code since time immemorial.
 [2008-05-15 17:53 UTC] subzero2000 (Stephen Leavitt)
I do not believe that the issue is properly addressed, as PEAR_Command_Channels::getDownloader() still references PEAR_Downloader, and anywhere PEAR_Command_Channels uses a downloader, it calls the downloadHttp() method. While downloadHttp is defined in both PEAR_Downloader and PEAR_REST, it would appear that PEAR_Command_Channels is using PEAR_Downloader's downloadHttp method rather than the one in PEAR_REST. (I confirmed this using a call to xdebug_get_function_stack() to get a stack trace of what functions were getting called when). Here is the console output showing I'm still seeing this problem: --- # pear list Installed packages, channel ========================================= Package Version State Archive_Tar 1.3.2 stable Console_Getopt 1.2.3 stable MIME_Type 1.0.0 stable PEAR 1.7.1 stable Structures_Graph 1.0.2 stable # pear channel-update -f Updating channel "" Cannot retrieve channel.xml for channel "" (File not valid (received: HTTP/1.1 400 Bad Request )) --- Making the changes in the patch attached to this bug report does indeed fix the problem for me. So, while the fix may be more appropriate to place in PEAR_REST, putting it in PEAR_Downloader is what appears to work, even with the latest PEAR. Also, this shouldn't cause any problems, because a Host: header is required for use with HTTP/1.1, and the lack of it in PEAR_Downloader is indeed a bug in any case. The reporter hit it because the section of code he mentions in the patch is used if the user has a proxy server defined (starting at line 1594), which I am assuming the reporter does. I most definitely have a properly defined proxy server in my pear config, and I still hit this bug unless I apply the patch attached to this bug report. Thanks.
 [2008-09-18 13:32 UTC] glatz (Alex Gitelzon)
I have a properly defined proxy server and this patch fixes the bug for me. I am running php 5.2.6.
 [2011-02-17 07:32 UTC] michelwilhelm (Michel Wilhelm)
Thank you so much for this info! The update was fixed this bug.