diff options
author | Maximilian Hils <git@maximilianhils.com> | 2013-12-15 06:42:58 +0100 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2013-12-15 06:42:58 +0100 |
commit | 7049becdfe5fa16820fc7dd3da0866cf08464efd (patch) | |
tree | bf00ecd827cbf48d51d6dac4b84c7c82e34e8282 /libpathod/pathoc.py | |
parent | 42aede6181c643bb5bbd35ca81b6c1b1c69ec4b5 (diff) | |
download | mitmproxy-7049becdfe5fa16820fc7dd3da0866cf08464efd.tar.gz mitmproxy-7049becdfe5fa16820fc7dd3da0866cf08464efd.tar.bz2 mitmproxy-7049becdfe5fa16820fc7dd3da0866cf08464efd.zip |
always return Content-Length: 0 if r is not set
Diffstat (limited to 'libpathod/pathoc.py')
-rw-r--r-- | libpathod/pathoc.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libpathod/pathoc.py b/libpathod/pathoc.py index 32707899..34dec94f 100644 --- a/libpathod/pathoc.py +++ b/libpathod/pathoc.py @@ -26,19 +26,19 @@ class Pathoc(tcp.TCPClient): self.ssl, self.sni = ssl, sni self.clientcert = clientcert - def http_connect(self, connect_to, wfile, rfile): - wfile.write( + def http_connect(self, connect_to): + self.wfile.write( 'CONNECT %s:%s HTTP/1.1\r\n'%tuple(connect_to) + '\r\n' ) - wfile.flush() - l = rfile.readline() + self.wfile.flush() + l = self.rfile.readline() if not l: raise PathocError("Proxy CONNECT failed") parsed = http.parse_response_line(l) if not parsed[1] == 200: raise PathocError("Proxy CONNECT failed: %s - %s"%(parsed[1], parsed[2])) - headers = http.read_headers(rfile) + headers = http.read_headers(self.rfile) def connect(self, connect_to=None): """ @@ -47,7 +47,7 @@ class Pathoc(tcp.TCPClient): """ tcp.TCPClient.connect(self) if connect_to: - self.http_connect(connect_to, self.wfile, self.rfile) + self.http_connect(connect_to) if self.ssl: try: self.convert_to_ssl(sni=self.sni, cert=self.clientcert) |