ObjFW  Diff

Differences From Artifact [718beda726]:

To Artifact [53041a12f7]:


23
24
25
26
27
28
29

30
31
32
33
34
35
36
#include <assert.h>

#import "OFHTTPRequest.h"
#import "OFString.h"
#import "OFThread.h"
#import "OFTCPSocket.h"
#import "OFURL.h"

#import "OFAutoreleasePool.h"

#import "TestsAppDelegate.h"

static OFString *module = @"OFHTTPRequest";
static OFCondition *cond;








>







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <assert.h>

#import "OFHTTPRequest.h"
#import "OFString.h"
#import "OFThread.h"
#import "OFTCPSocket.h"
#import "OFURL.h"
#import "OFDictionary.h"
#import "OFAutoreleasePool.h"

#import "TestsAppDelegate.h"

static OFString *module = @"OFHTTPRequest";
static OFCondition *cond;

68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
	if (![[client readLine] hasPrefix: @"User-Agent:"])
		assert(0);

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

	[client writeString: @"HTTP/1.0 200 OK\r\n"
			     @"Content-Length: 7\r\n"
			     @"\r\n"
			     @"foo\n"
			     @"bar"];
	[client close];

	return nil;
}







|







69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
	if (![[client readLine] hasPrefix: @"User-Agent:"])
		assert(0);

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

	[client writeString: @"HTTP/1.0 200 OK\r\n"
			     @"cONTeNT-lENgTH: 7\r\n"
			     @"\r\n"
			     @"foo\n"
			     @"bar"];
	[client close];

	return nil;
}
104
105
106
107
108
109
110



111
112
113
114
115
	    [OFString stringWithFormat: @"http://127.0.0.1:%" @PRIu16 "/foo",
					server->port]];

	TEST(@"+[requestWithURL]", (req = [OFHTTPRequest requestWithURL: url]))

	TEST(@"-[perform]", (res = [req perform]))




	[server join];

	[pool drain];
}
@end







>
>
>





105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
	    [OFString stringWithFormat: @"http://127.0.0.1:%" @PRIu16 "/foo",
					server->port]];

	TEST(@"+[requestWithURL]", (req = [OFHTTPRequest requestWithURL: url]))

	TEST(@"-[perform]", (res = [req perform]))

	TEST(@"Normalization of server header keys",
	     ([[res headers] objectForKey: @"Content-Length"] != nil))

	[server join];

	[pool drain];
}
@end