|Does Fiddler Modify Browser Requests in Any Way?||Clayton Carney||3/19/13 8:15 AM|
Let me provide some background for this question.
Using Firefox, I consistently receive a '400 Bad Request' error from my DSL modem (192.168.0.1) after a few clicks on any of the links of its website. This modem uses micro_httpd as its web server. Reviewing the source code for micro_httpd suggests that this error only occurs if the server receives a null request:
if ( fgets( line, sizeof(line), stdin ) == (char*) 0 )
send_error( 400, "Bad Request", (char*) 0, "No request found." );
When I run Firefox standalone, I get a 400 error every few clicks. However, when I have Fiddler running, I have NEVER gotten a 400 error (even after over 100 clicks). I can only speculate that Fiddler is somehow modifying the browser requests.
Any ideas or insights as to why this is happening?
|Re: Does Fiddler Modify Browser Requests in Any Way?||EricLaw||3/19/13 9:53 AM|
Generally speaking, Fiddler doesn't modify browser requests unless you tell it to.
Interestingly, I probably know why this is happening, since we debugged a similar problem with IE9 beta. The most likely explanation is that your router is single-threaded and can only handle a single connection at once. Most modern browsers will establish multiple connections in parallel so that there's a "free" connection available to service later requests. The problem is that this "free" connection gums up a single-threaded webserver since there's no request on the socket immediately and hence it waits a few seconds, then throws the 400.
Putting Fiddler in the middle makes such a problem go away because the browser's speculative/extra connection goes to Fiddler, not to the router. Fiddler only connects to the router when it's actually sending a request, which means that you never have an "empty" connection that causes the router to throw the 400.
|Re: Does Fiddler Modify Browser Requests in Any Way?||Clayton Carney||3/19/13 12:14 PM|
Thank you Eric! Very helpful insight. Was not aware of this browser behavior - and Firefox seems peculiar in this regard.
Using TCPView from SysInternals, I can see what you're referring to. It is very odd that a single click in Firefox opens 3-6 connections. Other browsers open only one connection per click. That may explain why Firefox is the only browser which receives a 400 error. Many of these connections remain open for several seconds. So far, if I wait until all connections close before clicking again, I don't see the error.
Although indirect in this case, Fiddler has once again saved the day! Thank you for this marvelous tool...