#15432 [Com]: fopen does not work with password-protected URLs
| From: | antispam at jensenworld dot net | Date: | Tue, 20 May 2003 22:34:25 +0000 |
| Subject: | #15432 [Com]: fopen does not work with password-protected URLs | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-40091@lists.php.net to get a copy of this message | ||
ID: 15432
Comment by: antispam at jensenworld dot net
Reported By: mqm at magma dot ca
Status: Closed
Bug Type: HTTP related
Operating System: Windows 2000
PHP Version: 4.1.0
New Comment:
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.....
Previous Comments:
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------
[2002-02-07 19:00:38] mqm at magma dot ca
For those who can't read hexdump/ascii together:
CURL:
GET /Status.htm HTTP/1.1
Authorization: Basic eDpjYW5hZGFv
User-Agent: curl/7.9.2 (win32) libcurl 7.9.2 (OpenSSL 0.9.6b)
Host: 192.168.3.1
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
PHP:
GET /Status.htm HTTP/1.0
Authorization: Basic eDpjYW5hZGFv
Host: 192.168.3.1
User-Agent: PHP/4.1.0
------------------------------------------------------------------------
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