note 79466 rejected from function.fopen by danbrown
| From: | danbrown@php.net | Date: | Mon, 08 Jun 2009 23:33:17 +0000 |
| Subject: | note 79466 rejected from function.fopen by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156544@lists.php.net to get a copy of this message | ||
Note Submitter: richard dot thomas at psysolutions dot com
----
fopen appears to choke on some redirects which do not give problems to browsers or wget
Example: this redirect
Location: /NetPerfMon/NetworkMap.asp?Map=Network Overview&Scale=50
Causes this request:
GET /NetPerfMon/NetworkMap.asp?Map=Network Overview&Scale=50 HTTP/1.0
Which is an invalid request due to the space. I don't recall if this is correct behavior
according to the RFC or not (I'm 100% sure that fopen shouldn't be sending requests with
spaces in but it may be that the Location: redirect shouldn't have spaces either) but the the
big two browsers and wget handle it gracefully
I'll also add a note that fopen does no cookie handling. The above is part of two redirects.
The first redirects to a page which issues cookies, the second redirects to the original page. If
there was not a problem with the space above, this would have led to a loop broken only by any
redirect limit rules coded into fopen. Handling cookies may be outside the scope of fopen but I
think it is worth noting in case anyone else would run into it.
PHP 5.2.0