How to use Fiddler to inspect traffic, investigate performance of web applications and services, debug web applications, test applications, and support client issues.
1. Ido Flatow
Senior Architect
Microsoft MVP
SELA Group
Debugging the Web with Fiddler
@idoFLATOW
http://bit.ly/flatow-blog
This presentation:
http://sdrv.ms/13mgEP9
6. www.devconnections.com
DEBUGGING THE WEB WITH FIDDLER
HOW FIDDLER WORKS…
Internet
Explorer
WinINET
Office
CryptoAPI WinHTTP
Fiddler
Firefox
Upstream
Proxy
Web Site
Firewall
7. www.devconnections.com
DEBUGGING THE WEB WITH FIDDLER
FIDDLER FACTS
A proxy server
An HTTP/HTTPS Sniffer
An HTTP Debugger
Written in .NET 3.5 / 4
A free utility (for now, cross your fingers)
An extensible application
A must tool for web developers
Unfortunately,
it doesn’t make coffee!
9. www.devconnections.com
DEBUGGING THE WEB WITH FIDDLER
THE SESSIONS LIST
9
Sequence and
color coding
Caching information
Origin process
Manual
commentsResponse size
10. www.devconnections.com
DEBUGGING THE WEB WITH FIDDLER
FIDDLER TO THE RESCUE
Browsers (Static sites, ASP.NET, J2EE, PHP)
Desktop applications that use HTTP
Web services
Windows Phone Emulator
Any device that supports
a proxy server ( )
12. www.devconnections.com
DEBUGGING THE WEB WITH FIDDLER
FILTER BY…
By process type
By specific process
By host
By process name/PID/svchost
By URL
By status code
By MIME or size
QuickExec
13. www.devconnections.com
DEBUGGING THE WEB WITH FIDDLER
FIDDLER AND HTTPS
HTTPS is secured - between two machines
Fiddler acts as a “machine-in-the-middle”
Generates certificates for web sites on-the-fly
Fiddler supports client certificates for
authentication
Supports excluding
problematic HTTPS sites
16. www.devconnections.com
DEBUGGING THE WEB WITH FIDDLER
REMINDER
UNDERSTANDING THE CONNECTION
Application
Network
APIs
Proxy Website
Second connection
From Fiddler to the server
First connection
From client to Fiddler
17. www.devconnections.com
DEBUGGING THE WEB WITH FIDDLER
VISUALIZE THE TRAFFIC WITH TIMELINE
Start End
Bar color = MIME
Red = new connection
Green = reused connection
Disk = cached response
Bar = begin receive
Stripes = buffered by Fiddler
Prefer stream over buffer
Use buffer when editing responses
18. www.devconnections.com
DEBUGGING THE WEB WITH FIDDLER
STATISTICS ARE IMPORTANT
Single page statistics give info on performance
Client processing
Server processing
Network latency
Server time:
ServerBeginResponse – ServerGotRequest
Upload time:
ServerGotRequest – ClientDoneRequest
Download time:
ServerDoneResponse – ServerBeginResponse
Watch out for misleading connection reuse
19. www.devconnections.com
DEBUGGING THE WEB WITH FIDDLER
DRAWING CONCLUSIONS
Reduce number of requests
Reduce traffic roundtrips
Reduce the size of requests and responses
Applying compression where needed
Identify non-cached responses
Use Fiddler to improve performance, not to
measure it!
21. www.devconnections.com
DEBUGGING THE WEB WITH FIDDLER
PLAY IT AGAIN, SAM
Why run the client scenario again, just to
resend the request?
Simply click “Replay”
Reissue a single request
Reissue a set of requests
Reissue unconditionally (no cache headers)
Reissue multiple times
22. www.devconnections.com
DEBUGGING THE WEB WITH FIDDLER
CHANGING REQUESTS WITH COMPOSER
Create any request from scratch
Use previous requests with drag-n-drop
Don’t bother calculating content length
www.bobthebuilder.com
23. www.devconnections.com
DEBUGGING THE WEB WITH FIDDLER
DEBUGGING LOCALHOST
In some cases, proxies are bypassed when
using localhost (127.0.0.1) addresses
What to do?
Use the machine’s name
Use fictitious DNS names
ipv4.fiddler or ipv6.fiddler
(converted to 127.0.0.1 / [::1])
localhost. or localhost.fiddler
(converted to localhost)
Force the use of a proxy with netsh
25. www.devconnections.com
DEBUGGING THE WEB WITH FIDDLER
WHAT DID YOU TYPE IN WRONG
TO GET IT TO CRASH?
Save traffic to file
Save sessions as .SAZ
(Zip) archive
.SAZ stores content
and session info
Other archiving
options:
HTTP Archive (HAR)
Visual Studio Web Test
26. www.devconnections.com
DEBUGGING THE WEB WITH FIDDLER
AUTO-RESPONDER
AN IN-MEMORY WEBSITE
If URI matches… then respond with…
Respond with file/redirection/breakpoint/drop
Not only that, you can also:
Import sessions as responses
Edit stored responses
Use original latency time (updatable)
Export and import rules
28. www.devconnections.com
DEBUGGING THE WEB WITH FIDDLER
CAN’T FIDDLE THE CLIENT?
FIDDLE THE SERVER
Local Network
Web ServerFiddler
8180
http://bit.ly/fiddler-reverse-proxy
29. www.devconnections.com
DEBUGGING THE WEB WITH FIDDLER
MINI FIDDLER, CUSTOMER-ORIENTED
Six simple steps
Install and run
Click 1. Start Capture
Browse the web site
[Take some screenshots]
Click 2. Stop Capture
Click 3. Save Capture
Email me the .SAZ file
29
30. www.devconnections.com
DEBUGGING THE WEB WITH FIDDLER
EXTENDING FIDDLER
Customize rules script
Create custom inspectors
Create requests and responses auto-modifiers
Create new exporter/importer
Extend QuickExec with new commands
Add menus and tabs
31. www.devconnections.com
DEBUGGING THE WEB WITH FIDDLER
FIDDLER IS MORE THAN A SNIFFER
Monitors traffic, yes, but also…
Controls traffic
Modifies traffic
Generates traffic
Easy to use
Extensible
32. www.devconnections.com
DEBUGGING THE WEB WITH FIDDLER
http://bit.ly/flatowblog
@IdoFlatow
idof@sela.co.il
My Info
Fiddler Website
http://www.fiddler2.com
http://groups.google.com/group/httpfiddler
Fiddler Forum
http://www.telerik.com/automated-testing-tools/blog/eric-lawrence.aspx
http://blogs.msdn.com/b/fiddler (older blog)
Fiddler Blog
http://sdrv.ms/13mgEP9
This Presentation
RESOURCES