php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #59974 methodRegister doesn't allow "_" to be in method name
Submitted: 2011-09-28 05:03 UTC Modified: 2012-02-21 13:28 UTC
From: thilo at cestona dot ro Assigned: mike (profile)
Status: Closed Package: pecl_http (PECL)
PHP Version: 5.3.6 OS: ubuntu
Private report: No CVE-ID: None
 [2011-09-28 05:03 UTC] thilo at cestona dot ro
Description:
------------
Currently a http request method name must only include
-, 0-9 and a-z A-Z. As it is tested against being "-" or HTTP_IS_CTYPE(alnum,.....).

But RPC over HTTP Protocol expects in an Echo Request the Method to be either RPC_IN_DATA or RPC_OUT_DATA which both include "_". This char is always recognized as illegal.

See Echo request description here:
http://msdn.microsoft.com/en-us/library/cc243982%28v=PROT.10%29.aspx

regards
Thilo

Reproduce code:
---------------
Reproduce with:
-----------------------------------
<?PHP

HttpRequest::methodRegister("RPC_IN_DATA");
-----------------------------------

Possible fix in http_request_method_api.c is:
-----------------------------------
--- http_request_method_api.c	2011-09-28 11:00:41.703593452 +0200
+++ http_request_method_api.c.new	2011-09-28 11:00:37.903593476 +0200
@@ -217,6 +217,10 @@
 				cncl[i] = '-';
 				break;
 			
+			case '_':
+				cncl[i] = '_';
+				break;
+			
 			default:
 				if (!HTTP_IS_CTYPE(alnum, method_name[i])) {
 					efree(cncl);
-----------------------------------


Expected result:
----------------
No php warning to be thrown:
"PHP Warning:  HttpRequest::methodRegister(): Request method contains illegal characters (RPC_OUT_DATA) in rpc.php on line 6"

Actual result:
--------------
This php warning is thrown:
"PHP Warning:  HttpRequest::methodRegister(): Request method contains illegal characters (RPC_OUT_DATA) in rpc.php on line 6"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-02-21 10:05 UTC] mike@php.net
Automatic comment from SVN on behalf of mike
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=323406
Log: allow underscores in methods

Fixes bug #59974 methodRegister doesn't allow &quot;_&quot; to be in method name
 [2012-02-21 13:28 UTC] mike@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2012-02-21 13:28 UTC] mike@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: mike
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 03:01:32 2024 UTC