This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dspublic@freemail.hu
Recipients dspublic@freemail.hu
Date 2013-03-29.16:25:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1364574303.8.0.198870267113.issue17575@psf.upfronthosting.co.za>
In-reply-to
Content
http.client modul, HTTPConnection object, send method

Missing an "else" for self.sock.sendall(data) try block.


...
if hasattr(data, "read") : 
            if self.debuglevel > 0: 
                print("sendIng a read()able") 
            encode = False 
            try: 
                mode = data.mode 
            except AttributeError: 
                # io.BytesIO and other file-like objects don't have a `mode` 
                # attribute. 
                pass 
            else: 
                if "b" not in mode: 
                    encode = True 
                    if self.debuglevel > 0: 
                        print("encoding file using iso-8859-1") 
            while 1: 
                datablock = data.read(blocksize) 
                if not datablock: 
                    break 
                if encode: 
                    datablock = datablock.encode("iso-8859-1") 
                self.sock.sendall(datablock) 
        else: #missing else
          try: 
              self.sock.sendall(data) 
          except TypeError: 
              if isinstance(data, collections.Iterable): 
                    for d in data: 
                        self.sock.sendall(d) 
              else: 
                  raise TypeError("data should be a bytes-like object " 
                                "or an iterable, got %r" % type(data))
History
Date User Action Args
2013-03-29 16:25:03dspublic@freemail.husetrecipients: + dspublic@freemail.hu
2013-03-29 16:25:03dspublic@freemail.husetmessageid: <1364574303.8.0.198870267113.issue17575@psf.upfronthosting.co.za>
2013-03-29 16:25:03dspublic@freemail.hulinkissue17575 messages
2013-03-29 16:25:03dspublic@freemail.hucreate