• Home
  • Raw
  • Download

Lines Matching +full:decode +full:- +full:uri +full:- +full:component

8 "HTTP - Hypertext Transfer Protocol", at
12 - RFC1808: the "relative URL" spec. (authoritative status)
13 - RFC1738 - the "URL standard". (authoritative status)
14 - RFC1630 - the "URI spec". (informational status)
43 __version__ = '1.17' # XXX This version is not always updated :-(
47 # Helper for non-unix systems
54 """OS-specific conversion from a relative URL of the 'file' scheme
59 """OS-specific conversion from a file system path to a relative URL
73 """Create a file-like object for the specified URL to read from."""
113 # exception raised when downloaded size does not match content-length
123 more than one set of global protocol-specific options.
124 Note -- this is a base class for those who don't want the
130 version = "Python-urllib/%s" % __version__
141 self.addheaders = [('User-Agent', self.version), ('Accept', '*/*')]
205 name = name.replace('-', '_')
265 size = -1
268 if "content-length" in headers:
269 size = int(headers["Content-Length"])
286 # raise exception if actual size does not match content-length header
342 h.putheader('Content-Type', 'application/x-www-form-urlencoded')
343 h.putheader('Content-Length', '%d' % len(data))
346 if proxy_auth: h.putheader('Proxy-Authorization', 'Basic %s' % proxy_auth)
353 if errcode == -1:
371 named http_error_DDD where DDD is the 3-digit error code."""
434 h.putheader('Content-Type',
435 'application/x-www-form-urlencoded')
436 h.putheader('Content-Length', '%d' % len(data))
439 if proxy_auth: h.putheader('Proxy-Authorization', 'Basic %s' % proxy_auth)
446 if errcode == -1:
488 'Content-Type: %s\nContent-Length: %d\nLast-modified: %s\n' %
535 dirs, file = dirs[:-1], dirs[-1]
562 headers += "Content-Type: %s\n" % mtype
564 headers += "Content-Length: %d\n" % retrlen
591 type = 'text/plain;charset=US-ASCII'
601 msg.append('Content-type: %s' % type)
606 msg.append('Content-Length: %d' % len(data))
626 """Default error handling -- don't raise an exception."""
630 """Error 302 -- relocated (temporarily)."""
650 elif 'uri' in headers:
651 newurl = headers['uri']
665 errmsg + " - Redirection to url '%s' is not allowed" %
672 """Error 301 -- also relocated (permanently)."""
676 """Error 303 -- also relocated (essentially identical to 302)."""
680 """Error 307 -- relocated, but turn POST into error."""
687 """Error 401 -- authentication required.
689 if not 'www-authenticate' in headers:
692 stuff = headers['www-authenticate']
709 """Error 407 -- proxy authentication required.
711 if not 'proxy-authenticate' in headers:
714 stuff = headers['proxy-authenticate']
944 self.refcount -= 1
1034 # unwrap('<URL:type://host/path>') --> 'type://host/path'
1035 # splittype('type:opaquestring') --> 'type', 'opaquestring'
1036 # splithost('//host[:port]/path') --> 'host[:port]', '/path'
1037 # splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'
1038 # splitpasswd('user:passwd') -> 'user', 'passwd'
1039 # splitport('host:port') --> 'host', 'port'
1040 # splitquery('/path?query') --> '/path', 'query'
1041 # splittag('/path#tag') --> '/path', 'tag'
1042 # splitattr('/path;attr1=value1;attr2=value2;...') ->
1044 # splitvalue('attr=value') --> 'attr', 'value'
1045 # unquote('abc%20def') -> 'abc def'
1046 # quote('abc def') -> 'abc%20def')
1058 """toBytes(u"URL") --> 'URL'."""
1066 " contains non-ASCII characters")
1070 """unwrap('<URL:type://host/path>') --> 'type://host/path'."""
1072 if url[:1] == '<' and url[-1:] == '>':
1073 url = url[1:-1].strip()
1079 """splittype('type:opaquestring') --> 'type', 'opaquestring'."""
1093 """splithost('//host[:port]/path') --> 'host[:port]', '/path'."""
1109 """splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'."""
1121 """splitpasswd('user:passwd') -> 'user', 'passwd'."""
1131 # splittag('/path#tag') --> '/path', 'tag'
1134 """splitport('host:port') --> 'host', 'port'."""
1138 _portprog = re.compile('^(.*):([0-9]*)$')
1148 def splitnport(host, defport=-1):
1150 Return given default port if no ':' found; defaults to -1.
1171 """splitquery('/path?query') --> '/path', 'query'."""
1183 """splittag('/path#tag') --> '/path', 'tag'."""
1194 """splitattr('/path;attr1=value1;attr2=value2;...') ->
1201 """splitvalue('attr=value') --> 'attr', 'value'."""
1218 _asciire = re.compile('([\x00-\x7f]+)')
1221 """unquote('abc%20def') -> 'abc def'."""
1229 append(unquote(str(bits[i])).decode('latin1'))
1249 """unquote('%7e/abc+def') -> '~/abc def'"""
1255 '0123456789' '_.-')
1262 """quote('abc def') -> 'abc%20def'
1267 RFC 2396 Uniform Resource Identifiers (URI): Generic Syntax lists
1273 Each of these characters is reserved in some component of a URL,
1308 """Encode a sequence of two-element tuples or dictionary into a URL query string.
1313 If the query arg is a sequence of two-element tuples, the order of the
1322 # it's a bother at times that strings and string-like objects are
1325 # non-sequence items should not work with len()
1326 # non-empty strings will fail this
1329 # zero-length sequences of all types will get here and succeed,
1330 # but that's a minor nit - since the original implementation
1335 raise TypeError, "not a valid non-string sequence or mapping object", tb
1358 # is this a sufficient test for sequence-ness?
1372 """Return a dictionary of scheme -> proxy server URL mappings.
1386 if value and name[-6:] == '_proxy':
1387 proxies[name[:-6]] = value
1389 # CVE-2016-1000110 - If we are running as CGI script, forget HTTP_PROXY
1390 # (non-all-lowercase) as it may be set from the web server by a "Proxy:"
1398 if name[-6:] == '_proxy':
1401 proxies[name[:-6]] = value
1403 proxies.pop(name[:-6], None)
1491 mask = 32 - mask
1502 """Return a dictionary of scheme -> proxy server URL mappings.
1526 """Return a dictionary of scheme -> proxy server URL mappings.
1535 # Std module, so should be around - but you never know!
1547 # Per-protocol settings
1572 """Return a dictionary of scheme -> proxy server URL mappings.
1585 # Std modules, so should be around - but you never know!
1627 # print "%s <--> %s" %( test, val )
1663 print round(t1 - t0, 3), 'sec'