Skip to Content
author's profile photo Former Member
Former Member

Some extra bytes appended to the http response by GzipResponseStream

My project needs to open pdf in browser. But the IE tells me that the file cannot be open by default program. It is either corrupted or has a incorrect filetype. And IE tries to download it.

I trace the http response by HttpWatch and find the content type is "application/pdf" which seems correct. And then I notice that there are some extra bytes in the http resposne. I use a servlet to retrieve the pdf file. The last few bytes of the http response are "%%EOF\n\r\n0\r\n\r\n". The last seven bytes "\r\n0\r\n\r\n" are the extra ones. I suspect these bytes are added by GzipResponseStream according to my debug result. But I dont have the source code so I am not sure.

If I do not use servlet but get the pdf file directly the http response will end with "%%EOF\n" and IE can open it successfully.

And I checked all responses from servlet they all have the extra seven bytes. Sometimes it cause the IE crash.

I appreciate if anyone can tell me what the problem is.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 02:12 AM

    This is not a problem. I never know it is the chunked encoding of http protocol.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 03, 2007 at 02:13 AM

    HTTP standard chunked encoding

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.