ObjFW  Diff

Differences From Artifact [723a0ca5c9]:

To Artifact [62848f22ab]:


294
295
296
297
298
299
300


301

302
303
304
305
306
307
308
309
310
311

312
313
314
315
316
317
318
294
295
296
297
298
299
300
301
302

303

304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320







+
+
-
+
-









+








- (void)raiseException: (id)exception
{
	[_client close];
	_client->_inProgress = false;

	[_client->_delegate client: _client
		 didPerformRequest: _request
			  response: nil
	      didFailWithException: exception
			 exception: exception];
			   request: _request];
}

- (void)createResponseWithSocketOrThrow: (OFTCPSocket *)sock
{
	OFURL *URL = _request.URL;
	OFHTTPClientResponse *response;
	OFString *connectionHeader;
	bool keepAlive;
	OFString *location;
	id exception;

	response = [[[OFHTTPClientResponse alloc] initWithSocket: sock]
	    autorelease];
	response.protocolVersionString = _version;
	response.statusCode = _status;
	response.headers = _serverHeaders;

418
419
420
421
422
423
424
425

426
427


428
429
430

431
432
433

434
435
436
437
438
439
440
420
421
422
423
424
425
426

427
428
429
430
431
432
433

434
435
436
437
438
439
440
441
442
443
444
445







-
+


+
+


-
+



+







			return;
		}
	}

	_client->_inProgress = false;

	if (_status / 100 != 2)
		@throw [OFHTTPRequestFailedException
		exception = [OFHTTPRequestFailedException
		    exceptionWithRequest: _request
				response: response];
	else
		exception = nil;

	[_client->_delegate performSelector: @selector(client:didPerformRequest:
						 response:)
						 response:exception:)
				 withObject: _client
				 withObject: _request
				 withObject: response
				 withObject: exception
				 afterDelay: 0];
}

- (void)createResponseWithSocket: (OFTCPSocket *)sock
{
	@try {
		[self createResponseWithSocketOrThrow: sock];
1126
1127
1128
1129
1130
1131
1132

1133











1134
1135
1136
1137
1138
1139
1140
1141

1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155

1156
1157
1158
1159
1160
1161
1162
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157

1158














1159
1160
1161
1162
1163
1164
1165
1166







+

+
+
+
+
+
+
+
+
+
+
+







-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+








	return _response;
}

-      (void)client: (OFHTTPClient *)client
  didPerformRequest: (OFHTTPRequest *)request
	   response: (OFHTTPResponse *)response
	  exception: (id)exception
{
	if (exception != nil) {
		/*
		 * Restore the delegate - we're giving up, but not reaching the
		 * release of the autorelease pool that contains us, so
		 * resetting it via -[dealloc] might be too late.
		 */
		_client.delegate = _delegate;

		@throw exception;
	}

	[[OFRunLoop currentRunLoop] stop];

	[_response release];
	_response = [response retain];

	[_delegate     client: client
	    didPerformRequest: request
		     response: response];
		     response: response
}

-	  (void)client: (OFHTTPClient *)client
  didFailWithException: (id)exception
	       request: (OFHTTPRequest *)request
{
	/*
	 * Restore the delegate - we're giving up, but not reaching the release
	 * of the autorelease pool that contains us, so resetting it via
	 * -[dealloc] might be too late.
	 */
	_client.delegate = _delegate;

	@throw exception;
		    exception: nil];
}

-    (void)client: (OFHTTPClient *)client
  didCreateSocket: (OFTCPSocket *)sock
	  request: (OFHTTPRequest *)request
{
	if ([_delegate respondsToSelector: