[ python-Bugs-913619 ] httplib: HTTPS does not close() connection properly

SourceForge.net noreply at sourceforge.net
Sat Jun 5 13:39:28 EDT 2004


Bugs item #913619, was opened at 2004-03-10 17:00
Message generated for change (Comment added) made by pmoore
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=913619&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: rick (sf_rick)
Assigned to: Nobody/Anonymous (nobody)
Summary: httplib:  HTTPS does not close() connection properly

Initial Comment:
When looping through requests to an HTTP server close()
closes out the active connection.  An the second loop
through a new HTTP connection is created.

When looping through requests to an HTTPS server
close() does not close the connection.  It keeps it
active.  On the second pass through the loop
httplib.HTTPS uses the previously initiated connection.
 Shouldn't close() close out the connection as it does
for the HTTP connection?

sample code to illustrate:

def getdata(): 
    params = urllib.urlencode({'username': 'test',
'password': 'test'})
    h = httplib.HTTPS(host = "test.site.com", port =
443, key_file = "fake.pem", cert_file = "fake.pem")
    h.putrequest('POST', '/scripts/cgi.exe?')
    h.putheader('Content-length', '%d'%len(params))
    h.putheader('Accept', 'text/plain')
    h.putheader('Host', 'test.site.com')
    h.endheaders()
    h.send(params)
    reply, msg, hdrs = h.getreply()
    data = h.getfile().read()
    file('test.file', 'w').write(data)
    h.close()
    


----------------------------------------------------------------------

Comment By: Paul Moore (pmoore)
Date: 2004-06-05 18:39

Message:
Logged In: YES 
user_id=113328

I'm not sure there's a need to document the makefile/close
thing in the Python manual, as the sock attribute isn't
publicly documented.

Internally, the constraint must be adhered to, but I can't
see evidence of where it isn't.

Unless the OP can provide a reproducible test case, I think
this can be closed with no change.

----------------------------------------------------------------------

Comment By: Aaron Brady (insomnike)
Date: 2004-06-05 18:17

Message:
Logged In: YES 
user_id=1057404

I've attempted to duplicate this with HEAD (05/Jun/04), and
I can't. 

HTTPSConnection uses a FakeSocket class which does reference
counting, meaning that the amount of sock.makefile() must
match sock.close() - this should be documented.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=913619&group_id=5470



More information about the Python-bugs-list mailing list