Differences From Artifact [d1280b74ae]:
- File
tests/OFHTTPClientTests.m
— part of check-in
[2a27cf3000]
at
2016-01-03 00:41:26
on branch trunk
— Update copyright
While at it, also update the mail address. (user: js, size: 2882) [annotate] [blame] [check-ins using] [more...]
To Artifact [b7f6ba3e3b]:
- File
tests/OFHTTPClientTests.m
— part of check-in
[58d4025602]
at
2016-01-05 14:10:52
on branch trunk
— Better randomization of HTTP header order
This should randomize the order of all headers now, preventing
fingerprinting by the order of HTTP headers. (user: js, size: 2882) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
58 59 60 61 62 63 64 | [cond unlock]; client = [listener accept]; if (![[client readLine] isEqual: @"GET /foo HTTP/1.1"]) OF_ENSURE(0); | | < | > | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | [cond unlock]; client = [listener accept]; if (![[client readLine] isEqual: @"GET /foo HTTP/1.1"]) OF_ENSURE(0); if (![[client readLine] hasPrefix: @"User-Agent:"]) OF_ENSURE(0); if (![[client readLine] isEqual: [OFString stringWithFormat: @"Host: 127.0.0.1:%" @PRIu16, _port]]) OF_ENSURE(0); if (![[client readLine] isEqual: @""]) OF_ENSURE(0); [client writeString: @"HTTP/1.0 200 OK\r\n" @"cONTeNT-lENgTH: 7\r\n" |
︙ | ︙ | |||
84 85 86 87 88 89 90 | @end @implementation TestsAppDelegate (OFHTTPClientTests) - (void)HTTPClientTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; HTTPClientTestsServer *server; | | | | | 84 85 86 87 88 89 90 91 92 93 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 | @end @implementation TestsAppDelegate (OFHTTPClientTests) - (void)HTTPClientTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; HTTPClientTestsServer *server; OFURL *URL; OFHTTPClient *client; OFHTTPRequest *request; OFHTTPResponse *response = nil; OFDataArray *data; cond = [OFCondition condition]; [cond lock]; server = [[[HTTPClientTestsServer 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:]", (client = [OFHTTPClient client]) && R(request = [OFHTTPRequest requestWithURL: URL]) && R(response = [client performRequest: request])) TEST(@"Normalization of server header keys", [[response headers] objectForKey: @"Content-Length"] != nil) TEST(@"Correct parsing of data", (data = [response readDataArrayTillEndOfStream]) && |
︙ | ︙ |