dont include port in the host section of the reuqest
This commit is contained in:
parent
d6baf888f1
commit
5fcce53a23
|
@ -1,6 +1,6 @@
|
|||
[tool.poetry]
|
||||
name = "spartan-py"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
description = "Library for spartan protocol"
|
||||
authors = ["Hedy Li <hedy@tilde.cafe>"]
|
||||
packages = [
|
||||
|
|
|
@ -13,14 +13,14 @@ class Request:
|
|||
self.data = data
|
||||
|
||||
def __repr__(self):
|
||||
return f"<Request {self.host}:{self.port} {self.path} {len(self.data)}>"
|
||||
return f"<Request {self.host} (port {self.port}) {self.path} {len(self.data)}>"
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.host}:{self.port} {self.path} {len(self.data)}"
|
||||
return f"{self.host} {self.path} {len(self.data)}"
|
||||
|
||||
def send(self):
|
||||
sock = socket.create_connection((self.host, self.port))
|
||||
host = f"{self.host}:{self.port}".encode("idna")
|
||||
host = f"{self.host}".encode("idna")
|
||||
path = self.path.encode("ascii")
|
||||
sock.send(b"%s %s %d\r\n" % (host, path, len(self.data)))
|
||||
sock.send(self.data.encode("ascii"))
|
||||
|
|
Loading…
Reference in New Issue