diff --git a/ChangeLog b/ChangeLog index 735ac028e..7c31a9a8a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ * Source/NSCalendarDate.m: Fix a few string parsing errors (check that string matches format in MacOS-X compatible manner). + * Source/GSHTTPURLHandle.m: try to detect socket being closed by + remote end of connection before we try writing to it. 2006-11-12 Richard Frith-Macdonald diff --git a/Source/GSHTTPURLHandle.m b/Source/GSHTTPURLHandle.m index c9fff1dec..fbaa15b70 100644 --- a/Source/GSHTTPURLHandle.m +++ b/Source/GSHTTPURLHandle.m @@ -1199,6 +1199,17 @@ static void debugWrite(GSHTTPURLHandle *handle, NSData *data) port = @"80"; } + /* An existing socket with keepalive may have been closed by the other + * end ... run the loop once (immediately returning) to try to detect it. + */ + if (sock != nil) + { + NSRunLoop *loop = [NSRunLoop currentRunLoop]; + + [loop acceptInputForMode: NSDefaultRunLoopMode + beforeDate: nil]; + } + if (sock == nil) { keepalive = NO; // New connection