Close connection after each request, avoid NSS shutdown problem.

The unit tests were failing when executed against an Apache server
in F-18 due to dangling references causing NSS shutdown to fail.

https://fedorahosted.org/freeipa/ticket/3180
This commit is contained in:
Rob Crittenden
2012-10-24 15:07:53 -04:00
parent 445744206b
commit fb7575d6b7
2 changed files with 30 additions and 5 deletions
+6
View File
@@ -238,6 +238,12 @@ class NSSConnection(httplib.HTTPConnection, NSSAddressFamilyFallback):
def connect(self):
self.connect_socket(self.host, self.port)
def close(self):
"""Close the connection to the HTTP server."""
if self.sock:
self.sock.close() # close it manually... there may be other refs
self.sock = None
def endheaders(self, message=None):
"""
Explicitly close the connection if an error is returned after the