ObjFW  Check-in [b9c811a236]

Overview
Comment:OFHTTPClient: Allow override of all headers

This makes it possible for the user to override Authorization and
Connection.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b9c811a2365053c9fe23c4eeedb85f1e3ebeceeaa6dea5df75ed693b61c82051
User & Date: js on 2016-01-05 14:58:01
Other Links: manifest | tags
Context
2016-01-05
17:09
configure: Only link -lpthread if available check-in: 80fae284b9 user: js tags: trunk
14:58
OFHTTPClient: Allow override of all headers check-in: b9c811a236 user: js tags: trunk
14:55
OFHTTPServer: Allow setting name to nil check-in: 6b4d138cc3 user: js tags: trunk
Changes

Modified src/OFHTTPClient.m from [ad2a18a279] to [c0960d74b1].

392
393
394
395
396
397
398
399


400
401
402
403
404
405
406
392
393
394
395
396
397
398

399
400
401
402
403
404
405
406
407







-
+
+







	} else
		[headers setObject: [URL host]
			    forKey: @"Host"];

	user = [URL user];
	password = [URL password];

	if ([user length] > 0 || [password length] > 0) {
	if (([user length] > 0 || [password length] > 0) &&
	    [headers objectForKey: @"Authorization"] == nil) {
		OFDataArray *authorizationData = [OFDataArray dataArray];
		OFString *authorization;

		[authorizationData addItems: [user UTF8String]
				      count: [user UTF8StringLength]];
		[authorizationData addItem: ":"];
		[authorizationData addItems: [password UTF8String]
430
431
432
433
434
435
436
437


438
439
440
441
442
443
444
431
432
433
434
435
436
437

438
439
440
441
442
443
444
445
446







-
+
+







		if ([headers objectForKey: @"Content-Type"] == nil)
			[headers setObject: @"application/x-www-form-"
					    @"urlencoded; charset=UTF-8"
				    forKey: @"Content-Type"];
	}

	if ([request protocolVersion].major == 1 &&
	    [request protocolVersion].minor == 0)
	    [request protocolVersion].minor == 0 &&
	    [headers objectForKey: @"Connection"] == nil)
		[headers setObject: @"keep-alive"
			    forKey: @"Connection"];

	keyEnumerator = [headers keyEnumerator];
	objectEnumerator = [headers objectEnumerator];

	while ((key = [keyEnumerator nextObject]) != nil &&