azzlack / Microsoft.AspNet.WebApi.MessageHandlers.Compression

Drop-in module for ASP.Net WebAPI that enables GZip and Deflate support
Apache License 2.0
194 stars 54 forks source link

Content headers missing from the request during compression #38

Closed nikhilshilimkar closed 8 years ago

nikhilshilimkar commented 8 years ago

Hi,

I see that the content headers are missing from the request during compression while the request size is more than 860 bytes. After debugging I came to know that the headers are ignored in the CopyTo() extension method(here and here). I had a Content-Length header in the request which lead the CopyTo() to return without copying the headers from the request to the target headers. Hence lead to missing of the headers from the request. I feel that instead of return statement it should have been continue so that the other headers can be copied to the target.

Please let me know if I am doing something wrong.

Thanks in advance.

nikhilshilimkar commented 8 years ago

Hi,

Did you got time to have a look at this issue

azzlack commented 8 years ago

Hi and sorry for the late response. Overwriting Content-Encoding and Content-Length is intentional. Since we are compressing the content the length should be changed, as for the Content-Encoding, i guess that it is not necessary to clear it, just append to it.

Will make a change later today and push it out