*** httplib.py Sun Oct 6 21:14:06 2002 --- httplib2.py Fri Nov 12 16:31:25 2004 *************** *** 557,563 **** if self.debuglevel > 0: print "send:", repr(str) try: ! self.sock.sendall(str) except socket.error, v: if v[0] == 32: # Broken pipe self.close() --- 557,574 ---- if self.debuglevel > 0: print "send:", repr(str) try: ! blocksize=8192 ! if hasattr(str,'read') : ! if self.debuglevel > 0: print "sendIng a read()able" ! data=str.read(blocksize) ! #sent=len(data) ! while data: ! self.sock.sendall(data) ! #print "Sent " + repr(sent) + " bytes" ! data=str.read(blocksize) ! #sent = sent + len(data) ! else: ! self.sock.sendall(str) except socket.error, v: if v[0] == 32: # Broken pipe self.close() *************** *** 717,723 **** self.putrequest(method, url) if body: ! self.putheader('Content-Length', str(len(body))) for hdr, value in headers.items(): self.putheader(hdr, value) self.endheaders() --- 728,749 ---- self.putrequest(method, url) if body: ! thelen=None ! try: ! thelen=str(len(body)) ! except TypeError, te: ! if hasattr(body,'name'): ! try: ! import os ! thelen=str(os.stat(body.name)[6]) ! except: ! #oh, well ! if self.debuglevel > 0: print "Cannot stat!!" ! pass ! ! if thelen is not None: ! self.putheader('Content-Length',thelen) ! for hdr, value in headers.items(): self.putheader(hdr, value) self.endheaders()