Post Reply 
ProxHTTPSProxy, a Proxomitron SSL Helper Program
May. 19, 2010, 09:26 PM (This post was last modified: May. 19, 2010 09:28 PM by Graycode.)
Post: #6
RE: ProxHTTPSProxy, a Proxomitron SSL Helper Program
(May. 19, 2010 06:56 AM)whenever Wrote:  Any feedbacks is welcome. Cool

That's very cool!

Code:
if method == 'POST':
    post_data_len = int(self.headers['Content-Length'])
Within do_METHOD it might be better to just check a Length header for non-zero, regardless of method=POST. I think for example AJAX may allow a POST having zero content, and I don't know what happens if Python tries to read or write zero length.
Code:
post_data_len = int(self.headers['Content-Length'])
if post_data_len > 0:


Code:
self.send_response(200)
I'm lost there. What if the server's response code was not 200? For example a 304 is very common. Also unclear whether that's a HTTP/1.0 or 1.1 response, but maybe connection persistence is not a factor in what you're using this for.

Code:
if keyword.lower() in ('transfer-encoding',):
    #print '%s: %s removed' % (keyword, value)
    continue
Dropping the Transfer-Encoding header seems odd, apparently Python already accounted for chunked data but not for gzip, deflate, etc? I'm not sure if any consideration for Content-Encoding is desired in that situation. Transfer-Encoding is generally hop-by-hop, Content-Encoding is more end-to-end.

Code:
def do_CONNECT(self):
        host_port = self.path
I don't see how the Python proxy would know the requested path. The SSL CONNECT method normally just has '/' even if the browser wanted '/something/other.htm'. It looks to my non-Python eyes that the 307 redirection would always send the browser to the root of the SSL host and not to the location that was wanted.

Code:
resp = 'HTTP/1.1 307 Moved Temporarily\r\nLocation: http://%s%s\r\n\r\n' % (host_port, path)
        ssl_sock.send(resp)
        ssl_sock.close()
The response is HTTP/1.1 so Proxo should assume persistence, but then its socket gets quickly closed.
Consider adding 'Connection: Close\r\n' to that, and maybe also 'Content-Length: 0\r\n'.
Add Thank You Quote this message in a reply
Post Reply 


Messages In This Thread
RE: ProxHTTPSProxy, a Proxomitron SSL Helper Program - Graycode - May. 19, 2010 09:26 PM

Forum Jump: