[wp-hackers] HTTP Request API edge case

John Blackbourn johnbillion+wp at gmail.com
Thu Jul 16 13:42:47 UTC 2009


2009/7/16 Peter Westwood <peter.westwood at ftwr.co.uk>:
>
> Agreed.
>
> I think we need to be careful to upper-case only certain method names.
>
> I believe this is the approach that browsers have taken for XMLHTTPRequest

The problem in this scenario is that when a call to wp_http_request()
contained the post method in lower case, it wasn't triggering the
right case in a switch statement as the switch was checking for POST.
(Around line 1280 of wp-includes/http.php in the case of cURL.)

Maybe the fix is actually to add two cases for each method in the
switch statements. Eg.

case 'HEAD':
case 'head':
 ....

case 'POST':
case 'post':
 ....

By not explicitly uppercasing the method you then allow for methods
(other than post and head in this situation) that may actually be case
sensitive.

Is this overengineering?

John


More information about the wp-hackers mailing list