ObjFW  Check-in [6ad892733b]

Overview
Comment:OFHTTPClient: Fix -[close] behaviour.

-[OFHTTPClient close] now closes the connection, no matter whether a
reply still exists. -[OFHTTPRequestReply close] only disposes of the
reference to the socket now, so that if the OFHTTPClient does not exist
anymore the socket is closed, but not if the OFHTTPClient is still alive
and in keep-alive mode. This is important so that closing a single reply
does not close the client even though keep-alive was used.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 6ad892733bcdef627e724d4b93d7a6736bfef6980ac880339f9946f2b18cd4eb
User & Date: js on 2013-07-29 19:42:12
Other Links: manifest | tags
Context
2013-07-29
19:43
Rename OFHTTPRequestReply to OFHTTPResponse. check-in: 36d0b1e2d8 user: js tags: trunk
19:42
OFHTTPClient: Fix -[close] behaviour. check-in: 6ad892733b user: js tags: trunk
10:40
OFHTTPClient: Remove a newline that was too much. check-in: 1cc51986a0 user: js tags: trunk
Changes

Modified src/OFHTTPClient.m from [4ed5c94cac] to [65175ae100].

241
242
243
244
245
246
247
248

249
250
251
252
253
254
255
{
	return [super numberOfBytesInReadBuffer] +
	    [_socket numberOfBytesInReadBuffer];
}

- (void)close
{
	[_socket close];

}
@end

@implementation OFHTTPClient
+ (instancetype)client
{
	return [[[self alloc] init] autorelease];







|
>







241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
{
	return [super numberOfBytesInReadBuffer] +
	    [_socket numberOfBytesInReadBuffer];
}

- (void)close
{
	[_socket release];
	_socket = nil;
}
@end

@implementation OFHTTPClient
+ (instancetype)client
{
	return [[[self alloc] init] autorelease];
607
608
609
610
611
612
613

614
615
616
617
618
619
620
621
622
623
				   reply: reply];

	return reply;
}

- (void)close
{

	[_socket release];
	_socket = nil;

	[_lastURL release];
	_lastURL = nil;

	[_lastReply release];
	_lastReply = nil;
}
@end







>










608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
				   reply: reply];

	return reply;
}

- (void)close
{
	[_socket close];
	[_socket release];
	_socket = nil;

	[_lastURL release];
	_lastURL = nil;

	[_lastReply release];
	_lastReply = nil;
}
@end