Why is http-response in chunked transfer-encoding only for some clients
I have an asp.net mvc application running on IIS 7. The problem I'm having is that depending on client the response may be recived (as seen through fiddler) as "chunked transfer-encoding. What I can't understand is why this only happens to some o开发者_如何学Gof my clients (even if two computers is on the same network with the same browser (IE 8) and not everyone, or vice versa?
Could anyone explain this to me?
Sorry for this late update, but the problem turned out to be the result of how the user reached the server. If the user was connected to the local lan through a vpn-connection the proxy would be sidestepped otherwise the proxy would be used. This resulted in two different results.
Chunked encoding is enabled on the server side if you prematurely flush the output stream. Do you have any user-agent-specific code might be calling Flush()?
RFC 2616 says:
All HTTP/1.1 applications MUST be able to receive and decode the "chunked" transfer-coding
Transfer-Encoding: chunked
is defined for HTTP/1.1. Are some of your clients using HTTP/1.0 or even (shudder) 0.9? In that case, the server must not use transfer-encoding, as it's not a part of the protocol.
Although most modern clients understand HTTP/1.1, most have an option to downgrade to 1.0 when using a proxy (for historical reasons - some older proxies had buggy 1.1 implementations). So, although the browser may understand 1.1, it can request 1.0 if so instructed.
Example: MSIE 6+ has this in the Internet Options dialog - tab Advanced
- HTTP 1.1 settings
- checkboxes "Use HTTP 1.1
" and "Use HTTP 1.1 through proxy connections
".
Also, chunked encoding is not activated for all responses - usually the server switches it on when Content-Length is not set, or when the output buffer is flushed.
精彩评论