client: fixed GET

This commit is contained in:
2021-03-20 21:45:28 +01:00
parent 797cdb0c0e
commit fa8d08d63d
5 changed files with 341 additions and 142 deletions

View File

@@ -196,6 +196,11 @@ def parse_uri(uri: str):
path = parsed.path
if len(path) == 0 or path[0] != '/':
path = "/" + path
port_pos = host.find(":")
if port_pos >= 0:
host = host[:port_pos]
return host, path
@@ -213,7 +218,7 @@ def main():
(host, path) = parse_uri(arguments.URI)
client = HTTPClient(host)
client.connect((host, arguments.port))
client.connect((host, int(arguments.port)))
message = "GET {path} HTTP/1.1\r\n".format(path=path)
message += "Accept: */*\r\nAccept-Encoding: identity\r\n"