[issue16904] http.client.HTTPConnection.send double send data

2013-10-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Seems this bug was fixed in issue16658.

--
nosy: +serhiy.storchaka
resolution: remind -> duplicate
stage:  -> committed/rejected
status: open -> closed
superseder:  -> Missing "return" in HTTPConnection.send()
type: crash -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16904] http.client.HTTPConnection.send double send data

2013-01-31 Thread Attila Gerendi

Attila Gerendi added the comment:

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!

--
resolution:  -> remind
title: Avoid unnecessary and possibly unsafe code from 
http.client.HTTPConnection.send -> http.client.HTTPConnection.send double send 
data
type: performance -> crash

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com