363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
|
if ([key isEqual: @"Host"]) {
pos = [value
rangeOfString: @":"
options: OF_STRING_SEARCH_BACKWARDS].location;
if (pos != OF_NOT_FOUND) {
host = [[value substringWithRange:
of_range(0, pos)] retain];
@try {
of_range_t range =
of_range(pos + 1, [value length] - pos - 1);
intmax_t portTmp = [[value
substringWithRange: range] decimalValue];
if (portTmp < 1 || portTmp > UINT16_MAX)
return [self sendErrorAndClose: 400];
port = (uint16_t)portTmp;
} @catch (OFInvalidFormatException *e) {
return [self sendErrorAndClose: 400];
}
} else {
host = [value retain];
port = 80;
}
}
return YES;
}
|
>
>
|
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
|
if ([key isEqual: @"Host"]) {
pos = [value
rangeOfString: @":"
options: OF_STRING_SEARCH_BACKWARDS].location;
if (pos != OF_NOT_FOUND) {
[host release];
host = [[value substringWithRange:
of_range(0, pos)] retain];
@try {
of_range_t range =
of_range(pos + 1, [value length] - pos - 1);
intmax_t portTmp = [[value
substringWithRange: range] decimalValue];
if (portTmp < 1 || portTmp > UINT16_MAX)
return [self sendErrorAndClose: 400];
port = (uint16_t)portTmp;
} @catch (OFInvalidFormatException *e) {
return [self sendErrorAndClose: 400];
}
} else {
[host release];
host = [value retain];
port = 80;
}
}
return YES;
}
|
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
|
if (host == nil || port == 0) {
if (HTTPMinorVersion > 0) {
[self sendErrorAndClose: 400];
return;
}
host = [server host];
port = [server port];
}
URL = [OFURL URL];
[URL setScheme: @"http"];
[URL setHost: host];
[URL setPort: port];
|
|
|
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
|
if (host == nil || port == 0) {
if (HTTPMinorVersion > 0) {
[self sendErrorAndClose: 400];
return;
}
host = [[server host] retain];
port = [server port];
}
URL = [OFURL URL];
[URL setScheme: @"http"];
[URL setHost: host];
[URL setPort: port];
|