Hi all:

    I am not sure if this is the right forum to post my query. But I am taking 
my chance.
    I am working on writing a proxy for HTTP/HTTPS traffic. For intercepting 
HTTPS traffic, I have to upgrade a socket to SSL. My problem is, before my 
upgradation is done completely, mozilla's reader tries to read something from 
the socket and that messes up the handshake. This happens on a different thread 
and hence I do not have any control over when this reader gets invoked. To make 
it more clear, I am describing my steps here:
1) Client sends a CONNECT request over the socket and proxy reads it.
2) The proxy responds with "200 OK" response telling the client that proxy is 
ready for SSL communication.
3) The client sends the handshake message (Client Hello)
4) Meanwhile proxy tries to upgrade the socket to make it able to handle SSL. 
(ref: http://www.mozilla.org/projects/security/pki/nss/ref/ssl/sslfnc.html).
5) While this upgrdation is going on, my breakpoint at 
nsSocketInputStream::Read() is hit. So even before the socket is configured 
completely for SSL, the reader is invoked. That causes the handshake to fail.

    My question is can I somehow have control over when the reader should be 
invoked? I would like the reading to start after my socket is completely 
upgraded.

    I have done a related posting on crypto group which is available at 
http://groups.google.com/group/mozilla.dev.tech.crypto/browse_thread/thread/65b08a99cdbf6b10/5dd42b14b10d23ba

    Please let me know if anybody has any ideas regarding this.
    Thanks.

Best Regards.
Umesh.
_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

Reply via email to