On 08/12/2012 03:15 PM, Ruediger Pluem wrote:
> 
> 
> humbed...@apache.org wrote:
>> Author: humbedooh
>> Date: Sun Aug 12 07:45:55 2012
>> New Revision: 1372054
>>
>> URL: http://svn.apache.org/viewvc?rev=1372054&view=rev
>> Log:
>> core:
>> Be less strict when checking whether Content-Type is set to 
>> "application/x-www-form-urlencoded" 
>> when parsing POST data, or we risk losing data with an appended charset.
>>
>> PR 53698
>> Reported by: Petter Berntsen < sluggr gmail.com >
>>
>> Modified:
>>     httpd/httpd/trunk/CHANGES
>>     httpd/httpd/trunk/server/util.c
>>
> 
>> Modified: httpd/httpd/trunk/server/util.c
>> URL: 
>> http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util.c?rev=1372054&r1=1372053&r2=1372054&view=diff
>> ==============================================================================
>> --- httpd/httpd/trunk/server/util.c (original)
>> +++ httpd/httpd/trunk/server/util.c Sun Aug 12 07:45:55 2012
>> @@ -2406,7 +2406,7 @@ AP_DECLARE(int) ap_parse_form_data(reque
>>  
>>      /* sanity check - we only support forms for now */
>>      ct = apr_table_get(r->headers_in, "Content-Type");
>> -    if (!ct || strcmp("application/x-www-form-urlencoded", ct)) {
>> +    if (!ct || ap_strcmp_match(ct, "application/x-www-form-urlencoded*")) {
> 
> ap_strcmp_match seems to be a lot of overhead for just prefix matching a 
> string.
> How about
> 
>  strncmp("application/x-www-form-urlencoded", ct, 33)
> 
> instead.
> 
> Regards
> 
> Rüdiger
> 
Yeah, that approach seems better. Took me a couple of tries to commit
the right version though - I blame the lack of coffee coupled with heavy
partying last night.

With regards
Daniel.

Reply via email to