ObjFW  Diff

Differences From Artifact [b47d8bb3a2]:

To Artifact [d2c22eea59]:


81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
	} _state;
	uint8_t _HTTPMinorVersion;
	of_http_request_method_t _method;
	OFString *_host, *_path;
	uint16_t _port;
	OFMutableDictionary *_headers;
	size_t _contentLength;
	OFStream *_body;
}

- (instancetype)initWithSocket: (OFTCPSocket *)sock
			server: (OFHTTPServer *)server;
- (bool)socket: (OFTCPSocket *)sock
   didReadLine: (OFString *)line
       context: (id)context







|







81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
	} _state;
	uint8_t _HTTPMinorVersion;
	of_http_request_method_t _method;
	OFString *_host, *_path;
	uint16_t _port;
	OFMutableDictionary *_headers;
	size_t _contentLength;
	OFStream *_requestBody;
}

- (instancetype)initWithSocket: (OFTCPSocket *)sock
			server: (OFHTTPServer *)server;
- (bool)socket: (OFTCPSocket *)sock
   didReadLine: (OFString *)line
       context: (id)context
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412

	[_timer invalidate];
	[_timer release];

	[_host release];
	[_path release];
	[_headers release];
	[_body release];

	[super dealloc];
}

- (bool)socket: (OFTCPSocket *)sock
   didReadLine: (OFString *)line
       context: (id)context







|







398
399
400
401
402
403
404
405
406
407
408
409
410
411
412

	[_timer invalidate];
	[_timer release];

	[_host release];
	[_path release];
	[_headers release];
	[_requestBody release];

	[super dealloc];
}

- (bool)socket: (OFTCPSocket *)sock
   didReadLine: (OFString *)line
       context: (id)context
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
			} @catch (OFInvalidFormatException *e) {
				return [self sendErrorAndClose: 400];
			}

			if (contentLength < 0)
				return [self sendErrorAndClose: 400];

			[_body release];
			_body = nil;
			_body = [[OFHTTPServerRequestBodyStream alloc]
			    initWithSocket: _socket
			     contentLength: contentLength];

			[_timer invalidate];
			[_timer release];
			_timer = nil;
		}







|
|
|







507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
			} @catch (OFInvalidFormatException *e) {
				return [self sendErrorAndClose: 400];
			}

			if (contentLength < 0)
				return [self sendErrorAndClose: 400];

			[_requestBody release];
			_requestBody = nil;
			_requestBody = [[OFHTTPServerRequestBodyStream alloc]
			    initWithSocket: _socket
			     contentLength: contentLength];

			[_timer invalidate];
			[_timer release];
			_timer = nil;
		}
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
	response = [[[OFHTTPServerResponse alloc]
	    initWithSocket: _socket
		    server: _server
		   request: request] autorelease];

	[[_server delegate] server: _server
		 didReceiveRequest: request
			      body: _body
			  response: response];

	objc_autoreleasePoolPop(pool);
}
@end

@implementation OFHTTPServerRequestBodyStream







|







647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
	response = [[[OFHTTPServerResponse alloc]
	    initWithSocket: _socket
		    server: _server
		   request: request] autorelease];

	[[_server delegate] server: _server
		 didReceiveRequest: request
		       requestBody: _requestBody
			  response: response];

	objc_autoreleasePoolPop(pool);
}
@end

@implementation OFHTTPServerRequestBodyStream