449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
|
_state = PARSING_HEADERS;
return true;
}
- (bool)parseHeaders: (OFString*)line
{
OFString *key, *value;
size_t pos;
if ([line length] == 0) {
intmax_t contentLength;
@try {
contentLength = [[_headers
|
|
|
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
|
_state = PARSING_HEADERS;
return true;
}
- (bool)parseHeaders: (OFString*)line
{
OFString *key, *value, *old;
size_t pos;
if ([line length] == 0) {
intmax_t contentLength;
@try {
contentLength = [[_headers
|
495
496
497
498
499
500
501
502
503
504
505
506
507
508
|
key = [line substringWithRange: of_range(0, pos)];
value = [line substringWithRange:
of_range(pos + 1, [line length] - pos - 1)];
key = normalizedKey([key stringByDeletingTrailingWhitespaces]);
value = [value stringByDeletingLeadingWhitespaces];
[_headers setObject: value
forKey: key];
if ([key isEqual: @"Host"]) {
pos = [value
rangeOfString: @":"
options: OF_STRING_SEARCH_BACKWARDS].location;
|
>
>
>
>
|
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
|
key = [line substringWithRange: of_range(0, pos)];
value = [line substringWithRange:
of_range(pos + 1, [line length] - pos - 1)];
key = normalizedKey([key stringByDeletingTrailingWhitespaces]);
value = [value stringByDeletingLeadingWhitespaces];
old = [_headers objectForKey: key];
if (old != nil)
value = [old stringByAppendingFormat: @",%@", value];
[_headers setObject: value
forKey: key];
if ([key isEqual: @"Host"]) {
pos = [value
rangeOfString: @":"
options: OF_STRING_SEARCH_BACKWARDS].location;
|