ObjFW  Diff

Differences From Artifact [4ed5c94cac]:

To Artifact [65175ae100]:

  • File src/OFHTTPClient.m — part of check-in [6ad892733b] at 2013-07-29 19:42:12 on branch trunk — 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. (user: js, size: 14602) [annotate] [blame] [check-ins using]


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