ObjFW  Check-in [ffb4484d97]

Overview
Comment:OFHTTPRequest: Add Connection: close to the request headers.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: ffb4484d97c18a289cd1881a72d22e9efc036035601f13d2f5f7cf171cc552de
User & Date: js on 2012-03-12 14:04:59
Other Links: manifest | tags
Context
2012-03-13
20:18
Move objc_{set,get}Property() declarations to macros.h. check-in: 92da2a3a5b user: js tags: trunk
2012-03-12
14:04
OFHTTPRequest: Add Connection: close to the request headers. check-in: ffb4484d97 user: js tags: trunk
12:58
OFHTTPRequest: Always close the connection after we received everything. check-in: 77b8ffc1e0 user: js tags: trunk
Changes

Modified src/OFHTTPRequest.m from [2f0fcffd8a] to [d6e43a2de8].

73
74
75
76
77
78
79
80

81
82
83
84
85
86
87
88
89
90
}

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







|
>
|
|
<







73
74
75
76
77
78
79
80
81
82
83

84
85
86
87
88
89
90
}

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

Modified tests/OFHTTPRequestTests.m from [bc194dbeb7] to [dca423d859].

61
62
63
64
65
66
67



68
69
70
71
72
73
74

	if (![[client readLine] isEqual: @"GET /foo HTTP/1.1"])
		assert(0);

	if (![[client readLine] isEqual:
	    [OFString stringWithFormat: @"Host: 127.0.0.1:%" @PRIu16, port]])
		assert(0);




	if (![[client readLine] hasPrefix: @"User-Agent:"])
		assert(0);

	if (![[client readLine] isEqual: @""])
		assert(0);








>
>
>







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77

	if (![[client readLine] isEqual: @"GET /foo HTTP/1.1"])
		assert(0);

	if (![[client readLine] isEqual:
	    [OFString stringWithFormat: @"Host: 127.0.0.1:%" @PRIu16, port]])
		assert(0);

	if (![[client readLine] isEqual: @"Connection: close"])
		assert(0);

	if (![[client readLine] hasPrefix: @"User-Agent:"])
		assert(0);

	if (![[client readLine] isEqual: @""])
		assert(0);