Differences From Artifact [1c3e517f32]:
- File tests/OFHTTPClientTests.m — part of check-in [813c00ccf0] at 2013-01-09 22:24:47 on branch trunk — Update copyright. (user: js, size: 2790) [annotate] [blame] [check-ins using]
To Artifact [70f5e875cd]:
- File
tests/OFHTTPClientTests.m
— part of check-in
[bdf9c4d96b]
at
2013-01-26 00:13:56
on branch trunk
— Make OFHTTPRequestReply a stream.
This also implements chunked transfer encoding for OFHTTPServer and adds
a property for the protocol version to OFHTTPRequest(Reply).Additionally, this makes it possible to add an async version of
OFHTTPClient. (user: js, size: 2986) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #import "OFHTTPRequestReply.h" #import "OFString.h" #import "OFTCPSocket.h" #import "OFThread.h" #import "OFCondition.h" #import "OFURL.h" #import "OFDictionary.h" #import "OFAutoreleasePool.h" #import "TestsAppDelegate.h" static OFString *module = @"OFHTTPClient"; static OFCondition *cond; | > | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | #import "OFHTTPRequestReply.h" #import "OFString.h" #import "OFTCPSocket.h" #import "OFThread.h" #import "OFCondition.h" #import "OFURL.h" #import "OFDictionary.h" #import "OFDataArray.h" #import "OFAutoreleasePool.h" #import "TestsAppDelegate.h" static OFString *module = @"OFHTTPClient"; static OFCondition *cond; |
︙ | ︙ | |||
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFHTTPClientTestsServer *server; OFURL *url; OFHTTPClient *client; OFHTTPRequest *request; OFHTTPRequestReply *reply; cond = [OFCondition condition]; [cond lock]; server = [[[OFHTTPClientTestsServer alloc] init] autorelease]; [server start]; [cond wait]; [cond unlock]; url = [OFURL URLWithString: [OFString stringWithFormat: @"http://127.0.0.1:%" @PRIu16 "/foo", server->port]]; TEST(@"-[performRequest:]", R(client = [OFHTTPClient client]) && R(request = [OFHTTPRequest requestWithURL: url]) && R(reply = [client performRequest: request])) TEST(@"Normalization of server header keys", | > | > > > > | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFHTTPClientTestsServer *server; OFURL *url; OFHTTPClient *client; OFHTTPRequest *request; OFHTTPRequestReply *reply; OFDataArray *data; cond = [OFCondition condition]; [cond lock]; server = [[[OFHTTPClientTestsServer alloc] init] autorelease]; [server start]; [cond wait]; [cond unlock]; url = [OFURL URLWithString: [OFString stringWithFormat: @"http://127.0.0.1:%" @PRIu16 "/foo", server->port]]; TEST(@"-[performRequest:]", R(client = [OFHTTPClient client]) && R(request = [OFHTTPRequest requestWithURL: url]) && R(reply = [client performRequest: request])) TEST(@"Normalization of server header keys", ([[reply headers] objectForKey: @"Content-Length"] != nil)) TEST(@"Correct parsing of data", (data = [reply readDataArrayTillEndOfStream]) && [data count] == 7 && !memcmp([data items], "foo\nbar", 7)) [server join]; [pool drain]; } @end |