Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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.

Not what you were looking for? View more on this topic or Ask a question