prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  GCE metadata ping taking ~75 seconds, not timing out after 3 seconds
  google-api-python-client: 1.6.2
  python version: 3.5.2
  
  ```
  from google.auth.compute_engine import _metadata
  import google.auth.transport._http_client
  request = google.auth.transport._http_client.Request()
  _metadata.ping(request=request)
  ```
  
  When running the following script, the default timeout of 3 seconds is not used. I'm instead seeing the script complete in about 75 seconds. If I print out the value of line 4, I get `False`. I'm not sure if that indicates that the call was successful, or if a timeout had occurred. I see this take ~75 seconds consistently If I set the environment variable `GCE_METADATA_TIMEOUT` to a value such as 10, the script still takes ~75 seconds.
  
  I'm running into this issue when using the pandas-gbq library. I'm writing a script to authorize pandas to access the gbq project. That library checks for the default google credentials, which do not exist in my case. [Here's my related issue with that library](https://github.com/pydata/pandas-gbq/issues/73).
  
  Is this an issue with the google-auth library?
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `google/auth/transport/_http_client.py`
  Content:
  ```
  1 # Copyright 2016 Google Inc.
  2 #
  3 # Licensed under the Apache License, Version 2.0 (the "License");
  4 # you may not use this file except in compliance with the License.
  5 # You may obtain a copy of the License at
  6 #
  7 #      http://www.apache.org/licenses/LICENSE-2.0
  8 #
  9 # Unless required by applicable law or agreed to in writing, software
  10 # distributed under the License is distributed on an "AS IS" BASIS,
  11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12 # See the License for the specific language governing permissions and
  13 # limitations under the License.
  14 
  15 """Transport adapter for http.client, for internal use only."""
  16 
  17 import logging
  18 import socket
  19 
  20 from six.moves import http_client
  21 from six.moves import urllib
  22 
  23 from google.auth import exceptions
  24 from google.auth import transport
  25 
  26 _LOGGER = logging.getLogger(__name__)
  27 
  28 
  29 class Response(transport.Response):
  30     """http.client transport response adapter.
  31 
  32     Args:
  33         response (http.client.HTTPResponse): The raw http client response.
  34     """
  35     def __init__(self, response):
  36         self._status = response.status
  37         self._headers = {
  38             key.lower(): value for key, value in response.getheaders()}
  39         self._data = response.read()
  40 
  41     @property
  42     def status(self):
  43         return self._status
  44 
  45     @property
  46     def headers(self):
  47         return self._headers
  48 
  49     @property
  50     def data(self):
  51         return self._data
  52 
  53 
  54 class Request(transport.Request):
  55     """http.client transport request adapter."""
  56 
  57     def __call__(self, url, method='GET', body=None, headers=None,
  58                  timeout=None, **kwargs):
  59         """Make an HTTP request using http.client.
  60 
  61         Args:
  62             url (str): The URI to be requested.
  63             method (str): The HTTP method to use for the request. Defaults
  64                 to 'GET'.
  65             body (bytes): The payload / body in HTTP request.
  66             headers (Mapping): Request headers.
  67             timeout (Optional(int)): The number of seconds to wait for a
  68                 response from the server. If not specified or if None, the
  69                 socket global default timeout will be used.
  70             kwargs: Additional arguments passed throught to the underlying
  71                 :meth:`~http.client.HTTPConnection.request` method.
  72 
  73         Returns:
  74             Response: The HTTP response.
  75 
  76         Raises:
  77             google.auth.exceptions.TransportError: If any exception occurred.
  78         """
  79         # socket._GLOBAL_DEFAULT_TIMEOUT is the default in http.client.
  80         if timeout is None:
  81             timeout = socket._GLOBAL_DEFAULT_TIMEOUT
  82 
  83         # http.client doesn't allow None as the headers argument.
  84         if headers is None:
  85             headers = {}
  86 
  87         # http.client needs the host and path parts specified separately.
  88         parts = urllib.parse.urlsplit(url)
  89         path = urllib.parse.urlunsplit(
  90             ('', '', parts.path, parts.query, parts.fragment))
  91 
  92         if parts.scheme != 'http':
  93             raise exceptions.TransportError(
  94                 'http.client transport only supports the http scheme, {}'
  95                 'was specified'.format(parts.scheme))
  96 
  97         connection = http_client.HTTPConnection(parts.netloc)
  98 
  99         try:
  100             _LOGGER.debug('Making request: %s %s', method, url)
  101 
  102             connection.request(
  103                 method, path, body=body, headers=headers, **kwargs)
  104             response = connection.getresponse()
  105             return Response(response)
  106 
  107         except (http_client.HTTPException, socket.error) as exc:
  108             raise exceptions.TransportError(exc)
  109 
  110         finally:
  111             connection.close()
  112
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/google/auth/transport/_http_client.py b/google/auth/transport/_http_client.py
  --- a/google/auth/transport/_http_client.py
  +++ b/google/auth/transport/_http_client.py
  @@ -94,7 +94,7 @@
                   'http.client transport only supports the http scheme, {}'
                   'was specified'.format(parts.scheme))
   
  -        connection = http_client.HTTPConnection(parts.netloc)
  +        connection = http_client.HTTPConnection(parts.netloc, timeout=timeout)
   
           try:
               _LOGGER.debug('Making request: %s %s', method, url)
  
verification_info: {"golden_diff": "diff --git a/google/auth/transport/_http_client.py b/google/auth/transport/_http_client.py\n--- a/google/auth/transport/_http_client.py\n+++ b/google/auth/transport/_http_client.py\n@@ -94,7 +94,7 @@\n                 'http.client transport only supports the http scheme, {}'\n                 'was specified'.format(parts.scheme))\n \n-        connection = http_client.HTTPConnection(parts.netloc)\n+        connection = http_client.HTTPConnection(parts.netloc, timeout=timeout)\n \n         try:\n             _LOGGER.debug('Making request: %s %s', method, url)\n", "issue": "GCE metadata ping taking ~75 seconds, not timing out after 3 seconds\ngoogle-api-python-client: 1.6.2\r\npython version: 3.5.2\r\n\r\n```\r\nfrom google.auth.compute_engine import _metadata\r\nimport google.auth.transport._http_client\r\nrequest = google.auth.transport._http_client.Request()\r\n_metadata.ping(request=request)\r\n```\r\n\r\nWhen running the following script, the default timeout of 3 seconds is not used. I'm instead seeing the script complete in about 75 seconds. If I print out the value of line 4, I get `False`. I'm not sure if that indicates that the call was successful, or if a timeout had occurred. I see this take ~75 seconds consistently If I set the environment variable `GCE_METADATA_TIMEOUT` to a value such as 10, the script still takes ~75 seconds.\r\n\r\nI'm running into this issue when using the pandas-gbq library. I'm writing a script to authorize pandas to access the gbq project. That library checks for the default google credentials, which do not exist in my case. [Here's my related issue with that library](https://github.com/pydata/pandas-gbq/issues/73).\r\n\r\nIs this an issue with the google-auth library?\n", "before_files": [{"content": "# Copyright 2016 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"Transport adapter for http.client, for internal use only.\"\"\"\n\nimport logging\nimport socket\n\nfrom six.moves import http_client\nfrom six.moves import urllib\n\nfrom google.auth import exceptions\nfrom google.auth import transport\n\n_LOGGER = logging.getLogger(__name__)\n\n\nclass Response(transport.Response):\n    \"\"\"http.client transport response adapter.\n\n    Args:\n        response (http.client.HTTPResponse): The raw http client response.\n    \"\"\"\n    def __init__(self, response):\n        self._status = response.status\n        self._headers = {\n            key.lower(): value for key, value in response.getheaders()}\n        self._data = response.read()\n\n    @property\n    def status(self):\n        return self._status\n\n    @property\n    def headers(self):\n        return self._headers\n\n    @property\n    def data(self):\n        return self._data\n\n\nclass Request(transport.Request):\n    \"\"\"http.client transport request adapter.\"\"\"\n\n    def __call__(self, url, method='GET', body=None, headers=None,\n                 timeout=None, **kwargs):\n        \"\"\"Make an HTTP request using http.client.\n\n        Args:\n            url (str): The URI to be requested.\n            method (str): The HTTP method to use for the request. Defaults\n                to 'GET'.\n            body (bytes): The payload / body in HTTP request.\n            headers (Mapping): Request headers.\n            timeout (Optional(int)): The number of seconds to wait for a\n                response from the server. If not specified or if None, the\n                socket global default timeout will be used.\n            kwargs: Additional arguments passed throught to the underlying\n                :meth:`~http.client.HTTPConnection.request` method.\n\n        Returns:\n            Response: The HTTP response.\n\n        Raises:\n            google.auth.exceptions.TransportError: If any exception occurred.\n        \"\"\"\n        # socket._GLOBAL_DEFAULT_TIMEOUT is the default in http.client.\n        if timeout is None:\n            timeout = socket._GLOBAL_DEFAULT_TIMEOUT\n\n        # http.client doesn't allow None as the headers argument.\n        if headers is None:\n            headers = {}\n\n        # http.client needs the host and path parts specified separately.\n        parts = urllib.parse.urlsplit(url)\n        path = urllib.parse.urlunsplit(\n            ('', '', parts.path, parts.query, parts.fragment))\n\n        if parts.scheme != 'http':\n            raise exceptions.TransportError(\n                'http.client transport only supports the http scheme, {}'\n                'was specified'.format(parts.scheme))\n\n        connection = http_client.HTTPConnection(parts.netloc)\n\n        try:\n            _LOGGER.debug('Making request: %s %s', method, url)\n\n            connection.request(\n                method, path, body=body, headers=headers, **kwargs)\n            response = connection.getresponse()\n            return Response(response)\n\n        except (http_client.HTTPException, socket.error) as exc:\n            raise exceptions.TransportError(exc)\n\n        finally:\n            connection.close()\n", "path": "google/auth/transport/_http_client.py"}], "after_files": [{"content": "# Copyright 2016 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\"\"\"Transport adapter for http.client, for internal use only.\"\"\"\n\nimport logging\nimport socket\n\nfrom six.moves import http_client\nfrom six.moves import urllib\n\nfrom google.auth import exceptions\nfrom google.auth import transport\n\n_LOGGER = logging.getLogger(__name__)\n\n\nclass Response(transport.Response):\n    \"\"\"http.client transport response adapter.\n\n    Args:\n        response (http.client.HTTPResponse): The raw http client response.\n    \"\"\"\n    def __init__(self, response):\n        self._status = response.status\n        self._headers = {\n            key.lower(): value for key, value in response.getheaders()}\n        self._data = response.read()\n\n    @property\n    def status(self):\n        return self._status\n\n    @property\n    def headers(self):\n        return self._headers\n\n    @property\n    def data(self):\n        return self._data\n\n\nclass Request(transport.Request):\n    \"\"\"http.client transport request adapter.\"\"\"\n\n    def __call__(self, url, method='GET', body=None, headers=None,\n                 timeout=None, **kwargs):\n        \"\"\"Make an HTTP request using http.client.\n\n        Args:\n            url (str): The URI to be requested.\n            method (str): The HTTP method to use for the request. Defaults\n                to 'GET'.\n            body (bytes): The payload / body in HTTP request.\n            headers (Mapping): Request headers.\n            timeout (Optional(int)): The number of seconds to wait for a\n                response from the server. If not specified or if None, the\n                socket global default timeout will be used.\n            kwargs: Additional arguments passed throught to the underlying\n                :meth:`~http.client.HTTPConnection.request` method.\n\n        Returns:\n            Response: The HTTP response.\n\n        Raises:\n            google.auth.exceptions.TransportError: If any exception occurred.\n        \"\"\"\n        # socket._GLOBAL_DEFAULT_TIMEOUT is the default in http.client.\n        if timeout is None:\n            timeout = socket._GLOBAL_DEFAULT_TIMEOUT\n\n        # http.client doesn't allow None as the headers argument.\n        if headers is None:\n            headers = {}\n\n        # http.client needs the host and path parts specified separately.\n        parts = urllib.parse.urlsplit(url)\n        path = urllib.parse.urlunsplit(\n            ('', '', parts.path, parts.query, parts.fragment))\n\n        if parts.scheme != 'http':\n            raise exceptions.TransportError(\n                'http.client transport only supports the http scheme, {}'\n                'was specified'.format(parts.scheme))\n\n        connection = http_client.HTTPConnection(parts.netloc, timeout=timeout)\n\n        try:\n            _LOGGER.debug('Making request: %s %s', method, url)\n\n            connection.request(\n                method, path, body=body, headers=headers, **kwargs)\n            response = connection.getresponse()\n            return Response(response)\n\n        except (http_client.HTTPException, socket.error) as exc:\n            raise exceptions.TransportError(exc)\n\n        finally:\n            connection.close()\n", "path": "google/auth/transport/_http_client.py"}]}