From 94a960208ba4922ac9f1e7c5f37ab74756e9f5f3 Mon Sep 17 00:00:00 2001 From: calvin Date: Sun, 11 Jan 2009 01:26:40 +0000 Subject: [PATCH] Upstream updates for httplib2.py git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@3908 e7d03fd6-7b0d-0410-9947-9c21f3af8025 --- linkcheck/httplib2.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/linkcheck/httplib2.py b/linkcheck/httplib2.py index 9f406d3b..a0d58f6c 100644 --- a/linkcheck/httplib2.py +++ b/linkcheck/httplib2.py @@ -765,9 +765,14 @@ class HTTPConnection: # If msg and message_body are sent in a single send() call, # it will avoid performance problems caused by the interaction # between delayed ack and the Nagle algorithim. - if message_body is not None: + if isinstance(message_body, str): msg += message_body + message_body = None self.send(msg) + if message_body is not None: + #message_body was not a string (i.e. it is a file) and + #we must run the risk of Nagle + self.send(message_body) def putrequest(self, method, url, skip_host=0, skip_accept_encoding=0): """Send a request to the server. @@ -949,12 +954,7 @@ class HTTPConnection: self._set_content_length(body) for hdr, value in headers.iteritems(): self.putheader(hdr, value) - if isinstance(body, str): - self.endheaders(body) - else: - self.endheaders() - if body: # when body is a file rather than a string - self.send(body) + self.endheaders(body) def getresponse(self): "Get the response from the server."