ObjFW  Check-in [df0769200f]

Overview
Comment:OFHTTPClient: Make sure / is not encoded in path
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: df0769200f01f6fd99099563e7e54e7904391db360781aa24657d9043ade8184
User & Date: js on 2016-07-03 17:25:34
Other Links: manifest | tags
Context
2016-07-03
18:22
OFFileManager: Replace remove with unlink / rmdir check-in: c52e685523 user: js tags: trunk
17:25
OFHTTPClient: Make sure / is not encoded in path check-in: df0769200f user: js tags: trunk
13:29
Add -[OFTarArchiveEntry description] check-in: f4a5590b58 user: js tags: trunk
Changes

Modified src/OFHTTPClient.m from [c92bc66cbb] to [382795589b].

314
315
316
317
318
319
320

321
322
323
324
325
326
327
- (OFHTTPResponse*)performRequest: (OFHTTPRequest*)request
			redirects: (size_t)redirects
{
	void *pool = objc_autoreleasePoolPush();
	OFURL *URL = [request URL];
	OFString *scheme = [URL scheme];
	of_http_request_method_t method = [request method];

	OFMutableString *requestString;
	OFString *user, *password;
	OFMutableDictionary OF_GENERIC(OFString*, OFString*) *headers;
	OFDataArray *body = [request body];
	OFTCPSocket *socket;
	OFHTTPClientResponse *response;
	OFString *line, *version, *redirect, *connectionHeader;







>







314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
- (OFHTTPResponse*)performRequest: (OFHTTPRequest*)request
			redirects: (size_t)redirects
{
	void *pool = objc_autoreleasePoolPush();
	OFURL *URL = [request URL];
	OFString *scheme = [URL scheme];
	of_http_request_method_t method = [request method];
	OFString *path;
	OFMutableString *requestString;
	OFString *user, *password;
	OFMutableDictionary OF_GENERIC(OFString*, OFString*) *headers;
	OFDataArray *body = [request body];
	OFTCPSocket *socket;
	OFHTTPClientResponse *response;
	OFString *line, *version, *redirect, *connectionHeader;
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
		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.
	 */


	if ([URL query] != nil)
		requestString = [OFMutableString stringWithFormat:
		    @"%s /%@?%@ HTTP/%@\r\n",
		    of_http_request_method_to_string(method),
		    [[URL path] stringByURLEncoding],
		    [[URL query] stringByURLEncoding],
		    [request protocolVersionString]];
	else
		requestString = [OFMutableString stringWithFormat:
		    @"%s /%@ HTTP/%@\r\n",
		    of_http_request_method_to_string(method),
		    [[URL path] stringByURLEncoding],
		    [request protocolVersionString]];

	headers = [[[request headers] mutableCopy] autorelease];
	if (headers == nil)
		headers = [OFMutableDictionary dictionary];

	if ([headers objectForKey: @"Host"] == nil) {







>
>



|
<





|
<







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
		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] stringByURLEncodingWithIgnoredCharacters: "/"];

	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) {