mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Add check for dropped connections.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@24079 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0341488c14
commit
e5610a82b1
2 changed files with 25 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
2006-11-12 Richard Frith-Macdonald <rfm@gnu.org>
|
2006-11-12 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/GSHTTPURLHandle.m: Clear pageInfo before load.
|
* Source/GSHTTPURLHandle.m: Clear pageInfo before load.
|
||||||
|
Improve checking for dropped connections.
|
||||||
|
|
||||||
2006-11-08 Richard Frith-Macdonald <rfm@gnu.org>
|
2006-11-08 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
|
|
@ -311,7 +311,7 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
||||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We might be in an idle state with an outstandng read on the
|
* We might be in an idle state with an outstanding read on the
|
||||||
* socket, keeping the connection alive, but waiting for the
|
* socket, keeping the connection alive, but waiting for the
|
||||||
* remote end to drop it.
|
* remote end to drop it.
|
||||||
*/
|
*/
|
||||||
|
@ -713,6 +713,22 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
||||||
loadComplete: NO];
|
loadComplete: NO];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (complete == NO && [d length] == 0)
|
||||||
|
{
|
||||||
|
/* The read failed ... dropped, but parsing is not complete.
|
||||||
|
* The request was sent, so we can't know whether it was
|
||||||
|
* lost in the network or the remote end received it and
|
||||||
|
* the response was lost.
|
||||||
|
*/
|
||||||
|
if (debug == YES)
|
||||||
|
{
|
||||||
|
NSLog(@"HTTP response not received - %@", parser);
|
||||||
|
}
|
||||||
|
[self endLoadInBackground];
|
||||||
|
[self backgroundLoadDidFailWithReason: @"Response not received"];
|
||||||
|
}
|
||||||
|
|
||||||
if (sock != nil
|
if (sock != nil
|
||||||
&& (connectionState == reading || connectionState == idle))
|
&& (connectionState == reading || connectionState == idle))
|
||||||
{
|
{
|
||||||
|
@ -1003,6 +1019,8 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
||||||
[sock closeFile];
|
[sock closeFile];
|
||||||
DESTROY(sock);
|
DESTROY(sock);
|
||||||
connectionState = idle;
|
connectionState = idle;
|
||||||
|
if (debug)
|
||||||
|
NSLog(@"%@ restart on new connection", NSStringFromSelector(_cmd));
|
||||||
[self _tryLoadInBackground: u];
|
[self _tryLoadInBackground: u];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1294,7 +1312,11 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data)
|
||||||
name: NSFileHandleReadCompletionNotification
|
name: NSFileHandleReadCompletionNotification
|
||||||
object: sock];
|
object: sock];
|
||||||
|
|
||||||
keepalive = YES; // Reusing a connection.
|
/* Reusing a connection. Set flag to say that it has been kept
|
||||||
|
* alive and we don't know if the other end has dropped it
|
||||||
|
* until we write to it and read some response.
|
||||||
|
*/
|
||||||
|
keepalive = YES;
|
||||||
method = [request objectForKey: GSHTTPPropertyMethodKey];
|
method = [request objectForKey: GSHTTPPropertyMethodKey];
|
||||||
if (method == nil)
|
if (method == nil)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue