mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-11 00:31:56 -06:00
Shut down duplicated file handle when HTTP response code is not 200.
httplib purposely keeps the socket open as a file on failed requests. We need to close this file otherwise nss_shutdown() will fail. https://fedorahosted.org/freeipa/ticket/1807
This commit is contained in:
parent
63a7a358d4
commit
a90e50cdf7
@ -293,6 +293,17 @@ class NSSHTTPS(httplib.HTTP):
|
||||
port = None
|
||||
self._setup(self._connection_class(host, port, strict, dbdir=dbdir))
|
||||
|
||||
def getreply(self):
|
||||
"""
|
||||
Override so we can close duplicated file connection on non-200
|
||||
responses. This was causing nss_shutdown() to fail with a busy
|
||||
error.
|
||||
"""
|
||||
(status, reason, msg) = httplib.HTTP.getreply(self)
|
||||
if status != 200:
|
||||
self.file.close()
|
||||
return (status, reason, msg)
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Loading…
Reference in New Issue
Block a user