Differences From Artifact [05de45f519]:
- File tests/OFHTTPClientTests.m — part of check-in [3b97fc3cd9] at 2014-01-04 00:24:08 on branch trunk — Update copyright. (user: js, size: 2921) [annotate] [blame] [check-ins using]
To Artifact [99ab8cb487]:
- File
tests/OFHTTPClientTests.m
— part of check-in
[bfc762c6d8]
at
2014-02-23 18:51:54
on branch trunk
— Add missing #define _POSIX_C_SOURCE 199309L
This also removes #include <time.h> from OFHTTPClientTests, as this
would cause <time.h> to be included without _POSIX_C_SOURCE set to
199309L and thus struct timespec would be missing. (user: js, size: 2881) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
12 13 14 15 16 17 18 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" | < < | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #include <string.h> #import "OFHTTPClient.h" #import "OFHTTPRequest.h" #import "OFHTTPResponse.h" #import "OFString.h" #import "OFTCPSocket.h" #import "OFThread.h" |
︙ | ︙ | |||
36 37 38 39 40 41 42 | static OFString *module = @"OFHTTPClient"; static OFCondition *cond; @interface OFHTTPClientTestsServer: OFThread { @public | | | | | | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | static OFString *module = @"OFHTTPClient"; static OFCondition *cond; @interface OFHTTPClientTestsServer: OFThread { @public uint16_t _port; } @end @implementation OFHTTPClientTestsServer - main { OFTCPSocket *listener, *client; [cond lock]; listener = [OFTCPSocket socket]; _port = [listener bindToHost: @"127.0.0.1" port: 0]; [listener listen]; [cond signal]; [cond unlock]; client = [listener accept]; if (![[client readLine] isEqual: @"GET /foo HTTP/1.1"]) OF_ENSURE(0); if (![[client readLine] isEqual: [OFString stringWithFormat: @"Host: 127.0.0.1:%" @PRIu16, _port]]) OF_ENSURE(0); if (![[client readLine] hasPrefix: @"User-Agent:"]) OF_ENSURE(0); if (![[client readLine] isEqual: @""]) OF_ENSURE(0); |
︙ | ︙ | |||
103 104 105 106 107 108 109 | [server start]; [cond wait]; [cond unlock]; url = [OFURL URLWithString: [OFString stringWithFormat: @"http://127.0.0.1:%" @PRIu16 "/foo", | | | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | [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", |
︙ | ︙ |