proxy.http.url module#

proxy.py#

⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on Network monitoring, controls & Application development, testing, debugging.

copyright
  1. 2013-present by Abhinav Singh and contributors.

license

BSD, see LICENSE for more details.

class proxy.http.url.Url(scheme: Optional[bytes] = None, username: Optional[bytes] = None, password: Optional[bytes] = None, hostname: Optional[bytes] = None, port: Optional[int] = None, remainder: Optional[bytes] = None)[source]#

Bases: object

urllib.urlparse doesn’t work for proxy.py, so we wrote a simple URL.

Currently, URL only implements what is necessary for HttpParser to work.

static _parse(raw: bytes) Tuple[Optional[bytes], Optional[bytes], bytes, Optional[int]][source]#
classmethod from_bytes(raw: bytes, allowed_url_schemes: Optional[List[bytes]] = None) proxy.http.url.Url[source]#

A URL within proxy.py core can have several styles, because proxy.py supports both proxy and web server use cases.

Example: For a Web server, url is like / or /get or /get?key=value For a HTTPS connect tunnel, url is like httpbin.org:443 For a HTTP proxy request, url is like http://httpbin.org/get

proxy.py internally never expects a https scheme in the request line. But Url class provides support for parsing any scheme present in the URLs. e.g. ftp, icap etc.

If a url with no scheme is parsed, e.g. //host/abc.js, then scheme defaults to http.

Further: 1) URL may contain unicode characters 2) URL may contain IPv4 and IPv6 format addresses instead of domain names

property has_credentials: bool#

Returns true if both username and password components are present.