MCPcopy Create free account
hub / github.com/boy-hack/hack-requests / _get_urlinfo

Method _get_urlinfo

HackRequests/HackRequests.py:119–137  ·  view source on GitHub ↗
(self, url, realhost: str)

Source from the content-addressed store, hash-verified

117 self.httpcon = conpool
118
119 def _get_urlinfo(self, url, realhost: str):
120 p = parse.urlparse(url)
121 scheme = p.scheme.lower()
122 if scheme != "http" and scheme != "https":
123 raise Exception("http/https only")
124 hostname = p.netloc
125 port = 80 if scheme == "http" else 443
126 if ":" in hostname:
127 hostname, port = hostname.split(":")
128 path = ""
129 if p.path:
130 path = p.path
131 if p.query:
132 path = path + "?" + p.query
133 if realhost:
134 if ":" not in realhost:
135 realhost = realhost + ":80"
136 hostname, port = realhost.split(":")
137 return scheme, hostname, int(port), path
138
139 def _send_output(self, oldfun, con, log):
140 def _send_output_hook(*args, **kwargs):

Callers 1

httpMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected