Differences From Artifact [f1da42cb60]:
- File
src/OFHTTPClient.m
— part of check-in
[1abe5a111f]
at
2012-12-13 20:53:19
on branch trunk
— Add of_tls_socket_class for 3rd-party TLS libs.
This removes of_http_client_tls_socket_class in favor of having one
symbol for all places where TLS would be desired. (user: js, size: 12344) [annotate] [blame] [check-ins using]
To Artifact [befaf122bc]:
- File src/OFHTTPClient.m — part of check-in [fbb9df7439] at 2012-12-14 01:42:05 on branch trunk — Rename -[OFHTTPRequest postData] to POSTData. (user: js, size: 12344) [annotate] [blame] [check-ins using]
| ︙ | ︙ | |||
117 118 119 120 121 122 123 |
redirects: (size_t)redirects
{
void *pool = objc_autoreleasePoolPush();
OFURL *URL = [request URL];
OFString *scheme = [URL scheme];
of_http_request_type_t requestType = [request requestType];
OFDictionary *headers = [request headers];
| | | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
redirects: (size_t)redirects
{
void *pool = objc_autoreleasePoolPush();
OFURL *URL = [request URL];
OFString *scheme = [URL scheme];
of_http_request_type_t requestType = [request requestType];
OFDictionary *headers = [request headers];
OFDataArray *POSTData = [request POSTData];
OFTCPSocket *sock;
OFHTTPRequestResult *result;
OFString *line, *path, *version;
OFMutableDictionary *serverHeaders;
OFDataArray *data;
OFEnumerator *keyEnumerator, *objectEnumerator;
OFString *key, *object, *contentLengthHeader;
|
| ︙ | ︙ | |||
205 206 207 208 209 210 211 | if (contentType == nil) contentType = @"application/x-www-form-urlencoded; " @"charset=UTF-8\r\n"; [sock writeFormat: @"Content-Type: %@\r\n", contentType]; [sock writeFormat: @"Content-Length: %d\r\n", | | | | | 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
if (contentType == nil)
contentType = @"application/x-www-form-urlencoded; "
@"charset=UTF-8\r\n";
[sock writeFormat: @"Content-Type: %@\r\n", contentType];
[sock writeFormat: @"Content-Length: %d\r\n",
[POSTData count] * [POSTData itemSize]];
}
[sock writeString: @"\r\n"];
/* Work around a bug in lighttpd, see above */
[sock flushWriteBuffer];
[sock setWriteBufferEnabled: NO];
if (requestType == OF_HTTP_REQUEST_TYPE_POST)
[sock writeBuffer: [POSTData cArray]
length: [POSTData count] * [POSTData itemSize]];
@try {
line = [sock readLine];
} @catch (OFInvalidEncodingException *e) {
@throw [OFInvalidServerReplyException
exceptionWithClass: [self class]];
}
|
| ︙ | ︙ | |||
312 313 314 315 316 317 318 | forKey: key]; continue; } newRequest = [OFHTTPRequest requestWithURL: newURL]; [newRequest setRequestType: requestType]; [newRequest setHeaders: headers]; | | | | 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 |
forKey: key];
continue;
}
newRequest = [OFHTTPRequest requestWithURL: newURL];
[newRequest setRequestType: requestType];
[newRequest setHeaders: headers];
[newRequest setPOSTData: POSTData];
[newRequest setMIMEType: [request MIMEType]];
if (status == 303) {
[newRequest
setRequestType: OF_HTTP_REQUEST_TYPE_GET];
[newRequest setPOSTData: nil];
[newRequest setMIMEType: nil];
}
[newRequest retain];
objc_autoreleasePoolPop(pool);
[newRequest autorelease];
|
| ︙ | ︙ |