1

Just wanted to ask if somebody encountered a problem of using HttpWebRequest class (or even new HttpClient) when trying upload some file to the server when Fiddler is launched.

I have encountered the bug, namely, AllowWriteStreamBuffering property of HttpWebRequest class is not working when the fiddler is launched, so upload progress is not working at all. Bytes are not sent instantly but buffored even if I set AllowWriteStreamBuffering to true, therefore I can't track upload progress. It is works ok when fiddler is not launched.

Moreover if I close fiddler when my application is uploading some file, it will crash too throwing WebException which says "The underlying connection was closed: An unexpected error occurred on a receive."

The same things is happening with new .net 4.5 HttpClient class.

Vlad
  • 854
  • 1
  • 10
  • 29
  • 2
    Fiddler acts as a proxy between your server and client. So when you access your server it goes though fiddler as a proxy server. If you close fiddler half way though this the connection will close, hence your last issue. Not sure about the AllowWriteStreamBuffering issue. I'd imagine fiddler doesn't forward this onto the server or vice versa. – Liam Dec 11 '12 at 16:52
  • My guess is that AllowWriteStreamBuffering isn't standard HTTP. It's possibly a Microsoft only implementation so Fiddler obviously doesn't do anything with it. Can you see it in the HTTP response-request you see in Fiddler? In the HTTP headers maybe? – Liam Dec 11 '12 at 16:59
  • no extra headers, AllowWriteStreamBuffering property is preventing bufforing so I can e.g. sent bytes by writing to request stream instantly, without bufforing these bytes in HttpWebBrowser cache, but fiddlers makes this property not working – Vlad Dec 11 '12 at 17:02
  • I've spent such a long time trying to make upload progress tracking but it wasn't succeess untill I close a fiddler – Vlad Dec 11 '12 at 17:05
  • Posted a few of the bits and pieces I found, not an expert on this tbh but maybe that'll help? – Liam Dec 11 '12 at 17:16
  • yes, thank you. I'm not an expert too, but I just was curious why it's behaving like that – Vlad Dec 11 '12 at 17:19

2 Answers2

3

Sorry for the confusion; Fiddler currently only supports streaming of responses and not requests.

Some proxies (like Fiddler) or other intermediaries will fully buffer a request before sending it to the server for performance or functional (e.g. virus scanning, breakpoint debugging) reasons.

http://www.fiddler2.com/fiddler/help/streaming.asp

EricLaw
  • 56,563
  • 7
  • 151
  • 196
  • so this is normal behaviour? and .net clasess actually thinks that they have sent bytes to server whereas these bytes was actually buforred by fiddler. Thanks – Vlad Dec 11 '12 at 23:12
  • Yes, this is expected; as far as the client knows, the server got the bytes. It's just that the "server" in this case is actually the "proxy." – EricLaw Dec 14 '12 at 17:17
2

Ok, caught my interest this, it appears for AllowWriteSteamBuffering to work the server must support Chunked transfer encoding. which led me to this forum post about proxies and the afore mentioned chunked encoding: https://groups.google.com/forum/?fromgroups=#!topic/httpfiddler/UkOiK96kg_k.

It appears from what I read here that when using a proxy you may or may not get the chunked encoding, etc. hence your issue.

I also found this which seemed a good detailed article on uploading with feedback which may be helpful?

http://blogs.msdn.com/b/delay/archive/2009/09/08/when-framework-designers-outsmart-themselves-how-to-perform-streaming-http-uploads-with-net.aspx

Liam
  • 27,717
  • 28
  • 128
  • 190