ObjFW  Diff

Differences From Artifact [d40fc902b8]:

To Artifact [718beda726]:


45
46
47
48
49
50
51
52
53


54
55
56
57
58
59
60
45
46
47
48
49
50
51


52
53
54
55
56
57
58
59
60







-
-
+
+







- main
{
	OFTCPSocket *listener, *client;

	[cond lock];

	listener = [OFTCPSocket socket];
	[listener bindToPort: port
		      onHost: @"127.0.0.1"];
	port = [listener bindToPort: 0
			     onHost: @"127.0.0.1"];
	[listener listen];

	[cond signal];
	[cond unlock];

	client = [listener accept];

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







-
-
-
-


+
+
+






-
-
-







	OFHTTPRequest *req;
	OFHTTPRequestResult *res;

	cond = [OFCondition condition];
	[cond lock];

	server = [[[OFHTTPRequestTestsServer alloc] init] autorelease];
	/* srand(time(NULL)) was already called by OFTCPSocket */
	server->port = (uint16_t)rand();
	if (server->port < 1024)
		server->port += 1024;
	[server start];

	[cond wait];
	[cond unlock];

	url = [OFURL URLWithString:
	    [OFString stringWithFormat: @"http://127.0.0.1:%" @PRIu16 "/foo",
					server->port]];

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

	[cond wait];
	[cond unlock];

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

	[server join];

	[pool drain];
}
@end