On Mar 28, 4:47 pm, Boris Zbarsky <[EMAIL PROTECTED]> wrote:

Boris, Thanks a lot for the quick response !

> Maya wrote:
> > I am facing a problem displaying contents with any MIME types which
> > need a plugin. I am testing it with PDF files but I think it will
> > pretty much be the same for any other applications.
>
> This is displaying them in a browser window, not via the <object> or <embed>
> elements, right?

Yes. That is correct.

>
> > Since the original URL is encypted in the HTTP request, Firefox does
> > not set the appropriate content-type.
>
> I'm not sure what you mean here.  What's encrypted where, and what does that
> have to do with the content-type?

I replace the HTTP and HTTPS handlers by a custom protocol handler
(The purpose of the new protocol is to encrypt
requests and responses sent using HTTP).The custom protocol handler
intercepts the requests, encrypts the request URLs and
sends them to a specific port on the web server with a bunch of
parameters (the request URL ciphertext being one of them).
So for example, if the url is https://www.abc.com/xyz.pdf, the new
protocol handler will change the URL to 
http://www.abc.com:4180?cipher_text=<encrypted
url>&.....(a bunch of other parameters).

My understanding was that Firefox sets the content-type header on the
channel based on the extension of the requested file/page. Since the
URL is transformed
(and hence the extension is lost), I was not sure how Firefox will
know the expected content type. (And I may be completely off
here...:-))

> > If I set the content-type, explicitly (for testing), in
> > OnStartRequest() of the StreamListener
>
> Of your decrypting stream listener, I assume?

Yes.

> > At what point, are the plug-ins selected when we are listening using
> > the StreamListener ?
>
> I'm not sure what you're asking here...

I apologize for being confusing. What I want to achieve is to be able
to invoke the Acrobat plugin correctly when the decrypted response
represents
the PDF file. Currently, the response data that comes in
OnDataAvailable() of my custom StreamListener is in the encrypted
form. I decrypt it and then send
it to the original listener of the channel (the one it receives from
the AsyncOpen(..) method). Based on the error I was getting ("The file
does not start with %PDF-"),
it seems like the plug-in is invoked even before the original listener
receives any data as the data that goes to the original listener does
begin with %PDF-.

Please let me know if I am not being clear and I will try to elaborate
more.

Thanks a lot for the (much needed) help again !

>
> > Are there any additional checks made by Firefox
> > to determine whether a file is a valid PDF file (other than checking
> > the beginning data) ?
>
> There are no checks made by Firefox at all.  The message you're getting is 
> from
> the plug-in itself -- it's getting data that doesn't start with "%PDF-".
>
> -Boris


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

Reply via email to