php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41852 proxy_login / proxy_pass ignored
Submitted: 2007-06-29 09:17 UTC Modified: 2007-07-02 16:04 UTC
From: bug-php at misc dot lka dot org dot lu Assigned:
Status: Not a bug Package: Streams related
PHP Version: 5.2.3 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bug-php at misc dot lka dot org dot lu
New email:
PHP Version: OS:

 

 [2007-06-29 09:17 UTC] bug-php at misc dot lka dot org dot lu
Description:
------------
When fopen'ing a web page, and using a proxy in the stream context, there is no way to specify proxy username and password

N.B. non-authenticating proxies work just fine.

Reproduce code:
---------------
<?php
$opts = array('http' =>
    array(
	  'proxy' => 'tcp://localhost:2001/',
	  'request_fulluri' => True,
	  'proxy_login' => 'fest1',
	  'proxy_password' => 'xxx'
    )
);
$context  = stream_context_create($opts);
$fp=fopen("http://www.lgl.lu/", "r", false, $context)
  or die("Cannot load\n");
print "fp=$fp";
while(!feof($fp)) {
  $in=fgets($fp,1024);
  print $in;
 }
?>


Expected result:
----------------
It should display the page from www.lgl.lu

Actual result:
--------------
It logs an error:
[Fri Jun 29 11:06:21 2007] [error] [client ::1] PHP Warning:  fopen(http://www.lgl.lu/) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: HTTP request failed! HTTP/1.0 407 Proxy Authentication Required\r\n in /home/aknaff/public_html/php-test/download.php on line 14

and this even though login and password are correct.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-02 16:04 UTC] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

The proxy authentication is generally done by sending the 
Proxy-Authorization header which you can add using the generic headers 
streams context option. Alternatively if authentication is done via HTTP 
Auth, you can do login@password in the URL.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 09:01:27 2024 UTC