Post Reply 
ProxHTTPSProxy, a Proxomitron SSL Helper Program
May. 31, 2010, 05:12 PM (This post was last modified: May. 31, 2010 05:27 PM by Graycode.)
Post: #81
RE: ProxHTTPSProxy, a Proxomitron SSL Helper Program
Are you using ProxHTTPSProxy or the other HTTPSProxy?

At the bottom of do_CONNECT in HTTPSProxy it seems to be closing the socket immediately after doing the shutdown(). Using shutdown for write should make the socket layer send a FIN after the last packet is sent (flushed), then the other side should ACK to close the socket, and final clean closure determined by a read of 0 bytes.

It may need to be something like:
Code:
# socket.SHUT_WR == 1
ssl_sock.shutdown(1)
ssl_sock.settimeout(6)   ## override previous use of settimeout(0.1)
while True:      ## wait for other side to ACK shutdown() closure
    if not ssl_sock.read()
        break
ssl_sock.close()

I've specified a 6 second timeout, don't know how much data will need to hit the wire, be processed by the other side and have the other side ACK to the FIN. When things work as they should, doing that adds no unnecessary delay. Considered using settimeout(0) or setblocking(True) for more permanent wait, maybe that's better. Something should be specified otherwise the previous settimeout(0.1) or (0.5) will still be in effect, and that may be insufficient to get all the data flushed back to Proxo.

There's a lot of things I don't know or don't understand about Python. What you've been able to accomplish is not easy or simple.
Add Thank You Quote this message in a reply
Post Reply 


Messages In This Thread
RE: ProxHTTPSProxy, a Proxomitron SSL Helper Program - Graycode - May. 31, 2010 05:12 PM

Forum Jump: