ObjFW  Diff

Differences From Artifact [bee3baba47]:

To Artifact [862d84b05e]:


41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

#define BUFFER_SIZE 1024

/*
 * FIXME: Currently, connections never time out, which means a DoS is possible.
 * TODO: Add support for chunked transfer encoding.
 * FIXME: Key normalization replaces headers like "DNT" with "Dnt".
 * FIXME: It is currently not possible to stop the server.
 * FIXME: Errors are not reported to the user.
 */

static const char*
status_code_to_string(short code)
{
	switch (code) {







<







41
42
43
44
45
46
47

48
49
50
51
52
53
54

#define BUFFER_SIZE 1024

/*
 * FIXME: Currently, connections never time out, which means a DoS is possible.
 * TODO: Add support for chunked transfer encoding.
 * FIXME: Key normalization replaces headers like "DNT" with "Dnt".

 * FIXME: Errors are not reported to the user.
 */

static const char*
status_code_to_string(short code)
{
	switch (code) {
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218

219
220
221
222
223
224
225
@implementation OFHTTPServer_Connection
- initWithSocket: (OFTCPSocket*)sock_
	  server: (OFHTTPServer*)server_
{
	self = [super init];

	sock = [sock_ retain];
	server = server_;
	state = AWAITING_PROLOG;

	return self;
}

- (void)dealloc
{
	[sock release];

	[host release];
	[path release];
	[headers release];
	[POSTData release];

	[super dealloc];
}







|








>







202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
@implementation OFHTTPServer_Connection
- initWithSocket: (OFTCPSocket*)sock_
	  server: (OFHTTPServer*)server_
{
	self = [super init];

	sock = [sock_ retain];
	server = [server_ retain];
	state = AWAITING_PROLOG;

	return self;
}

- (void)dealloc
{
	[sock release];
	[server release];
	[host release];
	[path release];
	[headers release];
	[POSTData release];

	[super dealloc];
}
592
593
594
595
596
597
598







599
600
601
602
603
604
605
	[listeningSocket listen];

	[listeningSocket asyncAcceptWithTarget: self
				      selector: @selector(OF_socket:
						    didAcceptSocket:
						    exception:)];
}








- (BOOL)OF_socket: (OFTCPSocket*)socket
  didAcceptSocket: (OFTCPSocket*)clientSocket
	exception: (OFException*)exception
{
	OFHTTPServer_Connection *connection;








>
>
>
>
>
>
>







592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
	[listeningSocket listen];

	[listeningSocket asyncAcceptWithTarget: self
				      selector: @selector(OF_socket:
						    didAcceptSocket:
						    exception:)];
}

- (void)stop
{
	[listeningSocket cancelAsyncRequests];
	[listeningSocket release];
	listeningSocket = nil;
}

- (BOOL)OF_socket: (OFTCPSocket*)socket
  didAcceptSocket: (OFTCPSocket*)clientSocket
	exception: (OFException*)exception
{
	OFHTTPServer_Connection *connection;