Bug #978833: Really close underlying socket in _socketobject.close.
Fix httplib.HTTPConnection.getresponse to not close the
socket if it is still needed for the response.
diff --git a/Lib/httplib.py b/Lib/httplib.py
index 36381de..95456ea 100644
--- a/Lib/httplib.py
+++ b/Lib/httplib.py
@@ -926,8 +926,8 @@
         self.__state = _CS_IDLE
 
         if response.will_close:
-            # this effectively passes the connection to the response
-            self.close()
+            # Pass the socket to the response
+            self.sock = None
         else:
             # remember this, so we can tell when it is complete
             self.__response = response
diff --git a/Lib/socket.py b/Lib/socket.py
index 4e83f09..52fb8e3 100644
--- a/Lib/socket.py
+++ b/Lib/socket.py
@@ -139,6 +139,8 @@
     __slots__ = []
     def _dummy(*args):
         raise error(EBADF, 'Bad file descriptor')
+    def close(self):
+        pass
     # All _delegate_methods must also be initialized here.
     send = recv = recv_into = sendto = recvfrom = recvfrom_into = _dummy
     __getattr__ = _dummy
@@ -157,6 +159,7 @@
             setattr(self, method, getattr(_sock, method))
 
     def close(self):
+        self._sock.close()
         self._sock = _closedsocket()
         dummy = self._sock._dummy
         for method in _delegate_methods:
diff --git a/Misc/NEWS b/Misc/NEWS
index 15e74f3..4644c82 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -42,6 +42,8 @@
 Library
 -------
 
+- Bug #978833: Really close underlying socket in _socketobject.close.
+
 - Bug #1459963: urllib and urllib2 now normalize HTTP header names correctly
   with title().