mirror of
https://github.com/swisspol/GCDWebServer.git
synced 2024-10-07 08:32:16 +08:00
Fix GCDWebServerParseURLEncodedForm to allow empty values.
If the input string is something like foo=&bar= then both foo and bar should be in the result, with the empty string as their corresponding value. The [scanner scanUpToString:@"&" ...] call was returning failure, because it was already positioned at the &. In this situation, just set value to the empty string.
This commit is contained in:
parent
40ea252ad6
commit
04f59a9214
@ -198,8 +198,9 @@ NSDictionary* GCDWebServerParseURLEncodedForm(NSString* form) {
|
||||
[scanner setScanLocation:([scanner scanLocation] + 1)];
|
||||
|
||||
NSString* value = nil;
|
||||
if (![scanner scanUpToString:@"&" intoString:&value]) {
|
||||
break;
|
||||
[scanner scanUpToString:@"&" intoString:&value];
|
||||
if (value == nil) {
|
||||
value = @"";
|
||||
}
|
||||
|
||||
key = [key stringByReplacingOccurrencesOfString:@"+" withString:@" "];
|
||||
|
Loading…
Reference in New Issue
Block a user