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
396
397
398
399
400
401
402
|
} else
socket = [self OF_closeAndCreateSocketForRequest: request];
/*
* As a work around for a bug with split packets in lighttpd when using
* HTTPS, we construct the complete request in a buffer string and then
* send it all at once.
*/
path = [URL path];
if (path == nil)
path = @"/";
if ([URL query] != nil)
requestString = [OFMutableString stringWithFormat:
@"%s %@?%@ HTTP/%@\r\n",
of_http_request_method_to_string(method), path,
[[URL query] stringByURLEncoding],
[request protocolVersionString]];
else
requestString = [OFMutableString stringWithFormat:
@"%s %@ HTTP/%@\r\n",
of_http_request_method_to_string(method), path,
[request protocolVersionString]];
headers = [[[request headers] mutableCopy] autorelease];
if (headers == nil)
headers = [OFMutableDictionary dictionary];
if ([headers objectForKey: @"Host"] == nil) {
if (([scheme isEqual: @"http"] && [URL port] != 80) ||
|
>
>
>
<
<
|
<
|
>
|
|
<
|
>
|
|
|
>
|
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
396
397
398
399
400
401
402
403
404
|
} else
socket = [self OF_closeAndCreateSocketForRequest: request];
/*
* As a work around for a bug with split packets in lighttpd when using
* HTTPS, we construct the complete request in a buffer string and then
* send it all at once.
*
* We do not use the socket's write buffer in case we need to resend
* the entire request (e.g. in case a keep-alive connection timed out).
*/
path = [URL path];
if (path == nil)
path = @"/";
requestString = [OFMutableString stringWithFormat:
@"%s %@", of_http_request_method_to_string(method), path];
if ([URL query] != nil) {
[requestString appendString: @"?"];
[requestString appendString: [URL query]];
}
[requestString appendString: @" HTTP/"];
[requestString appendString: [request protocolVersionString]];
[requestString appendString: @"\r\n"];
headers = [[[request headers] mutableCopy] autorelease];
if (headers == nil)
headers = [OFMutableDictionary dictionary];
if ([headers objectForKey: @"Host"] == nil) {
if (([scheme isEqual: @"http"] && [URL port] != 80) ||
|