>A stream converter is also an nsIStreamListener. For asynchronous
> conversion, you just call its
> onStartRequest/onDataAvailable/onStopRequest methods, or maybe you can
> directly pass it the nsIInputStreamPump you're probably using. Then, the
> converter will call the nsIStreamListener methods on the listener you
> passed to asyncConvertData.

I call directly onDataAvailable and it seems to be working fine if stream contains only gzip data. But my stream contains response headers(in text) and response body in gzip format.
 
Then I read whole response first using "nsIScriptableInputStream.read" and
separate out headers and response body from whole response. And then I create stream from response body using "nsIStringInputStream".
 
But I found that using "nsIScriptableInputStream.read", I am not be able to read whole
body. I think this is because response body in gzip format. It just read 3-4 character
of response body and come out, even though bytes are available there. Problem seems to be
where it appends '\0' character.
 
How can I resolve this problem??
 
One solution which I tried is that, I read original stream one by one character till headers, then I pass rest of the stream to streamConvertor. It works fine, but reading character one by one is expensive.
 
thanks,
Hitesh.
 
 

Reply via email to