ObjFW  Diff

Differences From Artifact [1e27dfeb94]:

To Artifact [339d905a8d]:


176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
{
	OFTCPSocket *_socket;
	OFHTTPServer *_server;
	OFHTTPRequest *_request;
	bool _chunked, _headersSent;
}

- initWithSocket: (OFTCPSocket *)socket
	  server: (OFHTTPServer *)server
	 request: (OFHTTPRequest *)request;
@end

@implementation OFHTTPServerResponse
- initWithSocket: (OFTCPSocket *)socket
	  server: (OFHTTPServer *)server
	 request: (OFHTTPRequest *)request
{
	self = [super init];

	_statusCode = 500;
	_socket = [socket retain];
	_server = [server retain];
	_request = [request retain];







|
|
|



|
|
|







176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
{
	OFTCPSocket *_socket;
	OFHTTPServer *_server;
	OFHTTPRequest *_request;
	bool _chunked, _headersSent;
}

- (instancetype)initWithSocket: (OFTCPSocket *)socket
			server: (OFHTTPServer *)server
		       request: (OFHTTPRequest *)request;
@end

@implementation OFHTTPServerResponse
- (instancetype)initWithSocket: (OFTCPSocket *)socket
			server: (OFHTTPServer *)server
		       request: (OFHTTPRequest *)request
{
	self = [super init];

	_statusCode = 500;
	_socket = [socket retain];
	_server = [server retain];
	_request = [request retain];
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
	OFString *_host, *_path;
	uint16_t _port;
	OFMutableDictionary *_headers;
	size_t _contentLength;
	OFMutableData *_body;
}

- initWithSocket: (OFTCPSocket *)socket
	  server: (OFHTTPServer *)server;
- (bool)socket: (OFTCPSocket *)socket
   didReadLine: (OFString *)line
       context: (id)context
     exception: (id)exception;
- (bool)parseProlog: (OFString *)line;
- (bool)parseHeaders: (OFString *)line;
-      (bool)socket: (OFTCPSocket *)socket
  didReadIntoBuffer: (char *)buffer
	     length: (size_t)length
	    context: (id)context
	  exception: (id)exception;
- (bool)sendErrorAndClose: (short)statusCode;
- (void)createResponse;
@end

@implementation OFHTTPServer_Connection
- initWithSocket: (OFTCPSocket *)socket
	  server: (OFHTTPServer *)server
{
	self = [super init];

	@try {
		_socket = [socket retain];
		_server = [server retain];
		_timer = [[OFTimer







|
|
















|
|







337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
	OFString *_host, *_path;
	uint16_t _port;
	OFMutableDictionary *_headers;
	size_t _contentLength;
	OFMutableData *_body;
}

- (instancetype)initWithSocket: (OFTCPSocket *)socket
			server: (OFHTTPServer *)server;
- (bool)socket: (OFTCPSocket *)socket
   didReadLine: (OFString *)line
       context: (id)context
     exception: (id)exception;
- (bool)parseProlog: (OFString *)line;
- (bool)parseHeaders: (OFString *)line;
-      (bool)socket: (OFTCPSocket *)socket
  didReadIntoBuffer: (char *)buffer
	     length: (size_t)length
	    context: (id)context
	  exception: (id)exception;
- (bool)sendErrorAndClose: (short)statusCode;
- (void)createResponse;
@end

@implementation OFHTTPServer_Connection
- (instancetype)initWithSocket: (OFTCPSocket *)socket
			server: (OFHTTPServer *)server
{
	self = [super init];

	@try {
		_socket = [socket retain];
		_server = [server retain];
		_timer = [[OFTimer
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
@synthesize host = _host, port = _port, delegate = _delegate, name = _name;

+ (instancetype)server
{
	return [[[self alloc] init] autorelease];
}

- init
{
	self = [super init];

	_name = @"OFHTTPServer (ObjFW's HTTP server class "
	    @"<https://heap.zone/objfw/>)";

	return self;







|







693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
@synthesize host = _host, port = _port, delegate = _delegate, name = _name;

+ (instancetype)server
{
	return [[[self alloc] init] autorelease];
}

- (instancetype)init
{
	self = [super init];

	_name = @"OFHTTPServer (ObjFW's HTTP server class "
	    @"<https://heap.zone/objfw/>)";

	return self;