Thanks for your imputs.
The problem is, I have to keep something in the socket (like \n). So the
socket is not really empty at the time of being upgraded. That might be
causing the PR_Read problem. However, for now I've a workaround which just
delays the upgradation a little bit. But I am still looking for a better
way to handle this.

Umesh.


> On Aug 30, 12:29 pm, "Umesh Bywar" <[EMAIL PROTECTED]> wrote:
>
>> 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.
>
> you need to either return a state indicating there are zero bytes
> available to read or block, depending on the APIs. I'm assuming that
> this Read isn't being called on the main thread.
>
> _______________________________________________
> dev-tech-xpcom mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-tech-xpcom
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>


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

Reply via email to