views:

648

answers:

2

Hi!

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 of 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.

A: 

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()?

RickNZ
What I can't understand is why the result differs between clients. My co-worker next to me on the same network with the same type of computer does not get the response sent to him (where both using IE 8) in a chunked format, while I do. Both using the same webbsite with the same scripts and same webbpage. If chunked encoding is enbaled on the server, should't it mean all responsed are sent as chunked?
Vinblad
Are you both using the same version of Fiddler? When using a proxy like Fiddler, it will be the one actually making the request to your web server, not the browser.
RickNZ
@RickNZ: While that's true, it's not the "x factor" here. Fiddler doesn't interfere with chunking.
EricLaw -MSFT-
Hi EricLaw! The difference in the response header is this.When chunked the Header.Miscellaneous.Server: mc (where MC probably is the subdomainname in IIS).When NOT chunked the Header.Miscellaneous.Server: Microsoft-IIS/7.0That's the only difference I can see (except for previously mentioned).
Vinblad
@RickNZ: EricLaw is the creator of the excellent Fiddler, so he probably knows what it does or does not ;) Anyway, if you want to minimize the observer effect, try capturing your traffic off the network, e.g. with Wireshark. Although it's a bit harder to use, it is a passive capture, so the traffic is not affected.
Piskvor
@Piskor: Something is obviously different between the two clients, since the response is different. If the browsers, OS, etc, are the same, then what else could it be? If not Fiddler, perhaps configuration settings? Using WireShark sounds like a great idea.
RickNZ
@RickNZ: BHOs and browser toolbars, registry settings, ActiveX objects, plugins?
Piskvor
@Piskvor: sure; all are possibilities. The first question is what's different in the HTTP request headers; hopefully that will lead to why they're different.
RickNZ
+1  A: 

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.

Piskvor
Thanx for the reply. Whats strange is that even with the same network and same version of IE (version 8). The problem occurs between different computers.
Vinblad
Yes, I understand that. What I'm saying is that two computers with an identical version of Win/IE can exhibit different behavior when those settings are enabled on one and disabled on another.
Piskvor
Thanx for the tip, we've verified that the settings are the same but the problem remains.
Vinblad