ObjFW  Check-in [294346482d]

Overview
Comment:OFHTTPRequest: Force "Connection: close".

This should not be part of the headers dictionary as it would allow the
user to remove it, but the implementation requires it.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 294346482d5b0e0eddf85d8aae05ed317206f973e19d91877606d50d767199af
User & Date: js on 2012-09-29 10:51:37
Other Links: manifest | tags
Context
2012-09-30
14:10
objfw-compile: Create build dir. check-in: ca9963ce69 user: js tags: trunk
2012-09-29
10:51
OFHTTPRequest: Force "Connection: close". check-in: 294346482d user: js tags: trunk
10:49
OFHTTPRequest: Fix too early release. check-in: 7a8056d3ed user: js tags: trunk
Changes

Modified src/OFHTTPRequest.m from [cb00731d28] to [4435d73c99].

74
75
76
77
78
79
80
81
82
83
84

85
86
87
88
89
90
91
}

- init
{
	self = [super init];

	requestType = OF_HTTP_REQUEST_TYPE_GET;
	headers = [[OFDictionary alloc] initWithKeysAndObjects:
	    @"Connection", @"close",
	    @"User-Agent", @"Something using ObjFW "
			   @"<https://webkeks.org/objfw/>", nil];

	storesData = YES;

	return self;
}

- initWithURL: (OFURL*)URL_
{







|
<
|
|
>







74
75
76
77
78
79
80
81

82
83
84
85
86
87
88
89
90
91
}

- init
{
	self = [super init];

	requestType = OF_HTTP_REQUEST_TYPE_GET;
	headers = [[OFDictionary alloc]

	    initWithObject: @"Something using ObjFW "
			    @"<https://webkeks.org/objfw/>"
		    forKey: @"User-Agent"];
	storesData = YES;

	return self;
}

- initWithURL: (OFURL*)URL_
{
249
250
251
252
253
254
255


256
257
258
259
260
261
262
		[sock writeFormat: @"%s %@ HTTP/1.1\r\n", type, path];

	if ([URL port] == 80)
		[sock writeFormat: @"Host: %@\r\n", [URL host]];
	else
		[sock writeFormat: @"Host: %@:%d\r\n", [URL host],
		    [URL port]];



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

	while ((key = [keyEnumerator nextObject]) != nil &&
	    (object = [objectEnumerator nextObject]) != nil)
		[sock writeFormat: @"%@: %@\r\n", key, object];







>
>







249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
		[sock writeFormat: @"%s %@ HTTP/1.1\r\n", type, path];

	if ([URL port] == 80)
		[sock writeFormat: @"Host: %@\r\n", [URL host]];
	else
		[sock writeFormat: @"Host: %@:%d\r\n", [URL host],
		    [URL port]];

	[sock writeString: @"Connection: close\r\n"];

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

	while ((key = [keyEnumerator nextObject]) != nil &&
	    (object = [objectEnumerator nextObject]) != nil)
		[sock writeFormat: @"%@: %@\r\n", key, object];