ObjFW  Diff

Differences From Artifact [814464cd03]:

To Artifact [aae9d41f78]:


399
400
401
402
403
404
405

406
407
408
409
410
411
412
413
414
	[_requestBody release];

	[super dealloc];
}

- (bool)stream: (OF_KINDOF(OFStream *))sock
   didReadLine: (OFString *)line

{
	if (line == nil)
		return false;

	@try {
		switch (_state) {
		case AWAITING_PROLOG:
			return [self parseProlog: line];
		case PARSING_HEADERS:







>

|







399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
	[_requestBody release];

	[super dealloc];
}

- (bool)stream: (OF_KINDOF(OFStream *))sock
   didReadLine: (OFString *)line
     exception: (id)exception
{
	if (line == nil || exception != nil)
		return false;

	@try {
		switch (_state) {
		case AWAITING_PROLOG:
			return [self parseProlog: line];
		case PARSING_HEADERS:
785
786
787
788
789
790
791

792
793











794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
	[_listeningSocket cancelAsyncRequests];
	[_listeningSocket release];
	_listeningSocket = nil;
}

-    (bool)socket: (OF_KINDOF(OFTCPSocket *))sock
  didAcceptSocket: (OF_KINDOF(OFTCPSocket *))acceptedSocket

{
	OFHTTPServer_Connection *connection = [[[OFHTTPServer_Connection alloc]











	    initWithSocket: acceptedSocket
		    server: self] autorelease];

	[(OFTCPSocket *)acceptedSocket setDelegate: connection];
	[acceptedSocket asyncReadLine];

	return true;
}

-		  (void)stream: (OF_KINDOF(OFStream *))stream
  didFailToAcceptWithException: (id)exception
{
	if ([_delegate respondsToSelector:
	    @selector(server:didReceiveExceptionOnListeningSocket:)])
		if ([_delegate			  server: self
		    didReceiveExceptionOnListeningSocket: exception])
			[stream asyncAccept];
}
@end







>

|
>
>
>
>
>
>
>
>
>
>
>








<
<
<
<
<
<
<
<
<
<

786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814










815
	[_listeningSocket cancelAsyncRequests];
	[_listeningSocket release];
	_listeningSocket = nil;
}

-    (bool)socket: (OF_KINDOF(OFTCPSocket *))sock
  didAcceptSocket: (OF_KINDOF(OFTCPSocket *))acceptedSocket
	exception: (id)exception
{
	OFHTTPServer_Connection *connection;

	if (exception != nil) {
		if (![_delegate respondsToSelector:
		    @selector(server:didReceiveExceptionOnListeningSocket:)])
			return false;

		return [_delegate		  server: self
		    didReceiveExceptionOnListeningSocket: exception];
	}

	connection = [[[OFHTTPServer_Connection alloc]
	    initWithSocket: acceptedSocket
		    server: self] autorelease];

	[(OFTCPSocket *)acceptedSocket setDelegate: connection];
	[acceptedSocket asyncReadLine];

	return true;
}










@end