/usr/share/pyshared/dap/util/http.py is in python-dap 2.2.6.7-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | import re
import httplib2
from dap.util import socks
httplib2.socks = socks
import dap.lib
from dap.exceptions import ClientError
def openurl(url, cache=None, username=None, password=None):
h = httplib2.Http(cache=cache,
timeout=dap.lib.TIMEOUT,
proxy_info=dap.lib.PROXY)
if username and password: h.add_credentials(username, password)
if dap.lib.VERBOSE: print url
resp, data = h.request(url, "GET", headers={'user-agent': dap.lib.USER_AGENT})
# Check for errors
if resp.get("content-description") == "dods_error":
# Parse response.
m = re.search('code = (?P<code>\d+);\s*message = "(?P<msg>.*)"', data, re.DOTALL | re.MULTILINE)
msg = 'Server error %(code)s: "%(msg)s"' % m.groupdict()
raise ClientError(msg)
return resp, data
|