Bug #61679 [Asn->Opn]: Error on non-standard HTTP methods
| From: | toby@php.net | Date: | Mon, 09 Apr 2012 13:58:14 +0000 |
| Subject: | Bug #61679 [Asn->Opn]: Error on non-standard HTTP methods | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-169355@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61679&edit=1
ID: 61679
User updated by: toby@php.net
Reported by: toby@php.net
Summary: Error on non-standard HTTP methods
-Status: Assigned
+Status: Open
Type: Bug
Package: Built-in web server
Operating System: Linux
PHP Version: 5.4.0
Assigned To: laruence
Block user comment: N
Private report: N
New Comment:
Just to make this clear: HTTP allows arbitrary method verbs to be used. Quoting the EBNF from RFC
2616, chapter 5.1.1:
Method = "OPTIONS" ; Section 9.2
| "GET" ; Section 9.3
â¦
| extension-method
extension-method = token
Event if the server itself does not support a certain method, it should not crash, but send a 405
(Method Not Allowed) response. However, for the built in web server, it makes sense to let the
executed script handle this and pipe arbitrary method verbs to it.
Previous Comments:
------------------------------------------------------------------------
[2012-04-09 13:58:01] laruence@php.net
hmm, I will try to fix it when I find what will apache does in such case :)
------------------------------------------------------------------------
[2012-04-09 13:47:56] toby@php.net
Description:
------------
The built in webserver bails out with an error on retrieval of a non-standard HTTP request method
(e.g. PATCH).
Test script:
---------------
Run the PHP built in web server on PORT 8042 and use the following script to reproduce the error:
$httpFilePointer = fopen(
'http://localhost:8042',
'r',
false,
stream_context_create(
array(
'http' => array(
'method' => 'PATCH',
),
)
)
);
Expected result:
----------------
A valid HTTP response, depending on the script run by the server.
Actual result:
--------------
The server logs to shell:
[Mon Apr 9 15:45:35 2012] ::1:37726 Invalid request (Malformed HTTP request)
The client complains about a malformed response:
Warning: fopen(http://localhost:8042): failed to open stream: HTTP request failed! in â¦
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61679&edit=1