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 sanyi
Recipients orsenthil, sanyi
Date 2013-01-31.13:03:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1359637403.2.0.0380268630746.issue16904@psf.upfronthosting.co.za>
In-reply-to
Content
Renamed the report since it's unsafe for sure.

This problem was previously called: Avoid unnecessary and possibly unsafe code from http.client.HTTPConnection.send. 


Imagine that the data parameter from HTTPConnection it's a file like object but it's not iterable, maybe some custom data wrapper.

the if hasattr(data, "read"): True branch will correctly send out the response then unnecessary continue to:

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))

and crash!
History
Date User Action Args
2013-01-31 13:03:23sanyisetrecipients: + sanyi, orsenthil
2013-01-31 13:03:23sanyisetmessageid: <1359637403.2.0.0380268630746.issue16904@psf.upfronthosting.co.za>
2013-01-31 13:03:23sanyilinkissue16904 messages
2013-01-31 13:03:22sanyicreate