From 7427640fb01b106faa8de17e94118cae1c7e7c04 Mon Sep 17 00:00:00 2001 From: James Lee Date: Tue, 8 Dec 2009 02:26:37 +0000 Subject: [PATCH] don't wait for a message body that will never come. fixes 659 git-svn-id: file:///home/svn/framework3/trunk@7748 4d416f70-5f16-0410-b530-b9f4589650da --- lib/rex/proto/http/packet.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/rex/proto/http/packet.rb b/lib/rex/proto/http/packet.rb index 540383999f..b753ac85d4 100644 --- a/lib/rex/proto/http/packet.rb +++ b/lib/rex/proto/http/packet.rb @@ -278,6 +278,15 @@ protected # no chunked transfer header, pretend this is the entire # buffer and call it done self.body_bytes_left = self.bufq.length + elsif(not self.transfer_chunked and not self.headers['Content-Length']) + # RFC 2616 says: "The presence of a message-body in a request + # is signaled by the inclusion of a Content-Length or + # Transfer-Encoding header field in the request's + # message-headers." + # + # So if we haven't seen either a Content-Length or a + # Transfer-Encoding header, there shouldn't be a message body. + self.body_bytes_left = 0 else # Otherwise we need to keep reading until EOF self.body_bytes_left = -1