#15432 [Csd->Bgs]: fopen does not work with password-protected URLs

From: Date: Wed, 21 May 2003 10:47:21 +0000
Subject: #15432 [Csd->Bgs]: fopen does not work with password-protected URLs
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-40125@lists.php.net to get a copy of this message
ID: 15432 Updated by: wez@php.net Reported By: mqm at magma dot ca -Status: Closed +Status: Bogus Bug Type: HTTP related Operating System: Windows 2000 PHP Version: 4.1.0 New Comment: read the rfcs for the differences between http/1.1 and 1.0. PHP uses 1.0 as it is much easier to implement. PHP 5 *might* have 1.1 support. If you really need advanced http usage, consider using the curl extension. Previous Comments: ------------------------------------------------------------------------ [2003-05-20 21:26:47] mqm at magma dot ca Linksys is being dumb by refusing to serve an HTTP 1.0 request. PHP is being dumb by saying it is HTTP 1.0 ( why can't it say 1.1 ? any real technical reason ?). That's basically what it boils down to. In my case I fork wget from PHP, fetch the page saving to a file, and process it from PHP. Ugly but works. Maybe one day I'll be able to use a pure PHP solution... [sigh] ------------------------------------------------------------------------ [2003-05-20 17:34:24] antispam at jensenworld dot net Unclear what the resolution was for this, is there a way to get php to say HTTP/1.1 instead of HTTP/1.0? I am having a similar problem, but I am getting: <br> <b>Warning</b>: fopen("http://...@192.168.1.1/", "r") - Inappropriate ioctl for device in <b>/home/exoplanet/devel/php_test/urlcp.php</b> on line <b>17</b><br> Line 17 is the fopen..... ------------------------------------------------------------------------ [2002-02-08 10:46:36] shiflett@php.net There's the problem. Your LinkSys "web server" did not like the way PHP was passing the authorization information. However, since it used the exact same Authorization header as your browser's request, there is no good reason why the response should demand a username/password, since they were sent successfully in the initial request. ------------------------------------------------------------------------ [2002-02-08 09:33:55] mqm at magma dot ca This is the response from the Linksys to PHP: HTTP/1.1 401 Authorization Required WWW-Authenticate: Basic realm="Linksys BEFSR41/BEFSR11/BEFSRU31" Content-type: text/html Expires: Thu, 13 Dec 1969 10:29:00 GMT Pragma: no-cache <html><head><title>401 Authorization Required</title></head> <body bgcolor=red text=white><h1>401 Authorization Required</h1> This server could not verify that you are authorized to access. Either you supplied the wrong credentials(e.g., bad password), or your browser doesn't understand how to supply the credentials required </body></html> ------------------------------------------------------------------------ [2002-02-07 22:49:41] shiflett@php.net Since you can sniff traffic, can you inspect the HTTP response as well? Perhaps your LinkSys web server software is asking to upgrade to HTTP/1.1 (since "upgrading" your request's declared version appeared to solve it). If not, it might at least reveal some sort of HTTP response code that is causing problems for PHP. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/15432 -- Edit this bug report at http://bugs.php.net/?id=15432&edit=1

« previous php.bugs (#40125) next »