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

From: Date: Wed, 21 May 2003 02:26:47 +0000
Subject: #15432 [Csd]: fopen does not work with password-protected URLs
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-40110@lists.php.net to get a copy of this message
ID: 15432 User updated by: mqm at magma dot ca Reported By: mqm at magma dot ca Status: Closed Bug Type: HTTP related Operating System: Windows 2000 PHP Version: 4.1.0 New Comment: 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] Previous Comments: ------------------------------------------------------------------------ [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. ------------------------------------------------------------------------ [2002-02-07 19:02:43] mqm at magma dot ca The problem seems to be the HTTP/1.0 If I telnet to port 80 and manually send the headers below, it all works. GET /Status.htm HTTP/1.1 Authorization: Basic eDpjYW5hZGFv Host: 192.168.3.1 User-Agent: PHP/4.1.0 Maybe the Linksys does not like the HTTP/1.0 line. ------------------------------------------------------------------------ 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 (#40110) next »