From 28565f9421186f1de8edee1ea4070cbcef970ccc Mon Sep 17 00:00:00 2001 From: bradfitz Date: Fri, 16 Sep 2005 00:46:47 +0000 Subject: [PATCH] + -- do a final little read before closing an HTTP connection + to make sure we have no unread data in kernel (notably + an extra "\r\n" from an IE post), so when we do close, we + don't send a RST packet to the end user. Thanks to Kevin + Lewandowski from discogs.com for the bug report. git-svn-id: http://code.sixapart.com/svn/perlbal/trunk@441 6caf28e9-730f-0410-b62b-a31386fe13fb --- CHANGES | 6 ++++++ lib/Perlbal/ClientHTTPBase.pm | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/CHANGES b/CHANGES index 61d0813..89edb22 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,9 @@ + -- do a final little read before closing an HTTP connection + to make sure we have no unread data in kernel (notably + an extra "\r\n" from an IE post), so when we do close, we + don't send a RST packet to the end user. Thanks to Kevin + Lewandowski from discogs.com for the bug report. + -- use Danga::Socket's AddTimer interface to disconnect stale persistent connections every 5 seconds, driven by a timer, rather than every 15 seconds, driven by diff --git a/lib/Perlbal/ClientHTTPBase.pm b/lib/Perlbal/ClientHTTPBase.pm index 383a930..424a4c3 100644 --- a/lib/Perlbal/ClientHTTPBase.pm +++ b/lib/Perlbal/ClientHTTPBase.pm @@ -145,6 +145,10 @@ sub http_response_sent { $self->{do_die} ) { + # do a final read so we don't have unread_data_waiting and RST + # the connection. IE and others send an extra \r\n after POSTs + my $dummy = $self->read(5); + # close if we have no response headers or they say to close $self->close("no_keep_alive"); return 0;