Flesk really has an answer to this (+1).
Another direct way to debug HTTP connections is Netcat , which is basically a powerful telnet utility.
So, let's say you want to debug what happens in your HTTP request:
$ nc www.windowsphone.com 80 GET /en-US/apps?list=free HTTP/1.0 Host: www.windowsphone.com User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
This will send the request header to the server (you need to press enter twice to send).
After that, the server will respond:
HTTP/1.1 302 Found Location: https://login.live.com/login.srf?wa=wsignin1.0&rpsnv=11&checkda=1&ct=1320745265&rver=6.1.6195.0&wp=MBI&wreply=http:%2F%2Fwww.windowsphone.com%2Fen-US%2Fapps%3Flist%3Dfree&lc=1033&id=268289 Server: Microsoft-IIS/7.5 Set-Cookie: WPMSLSS=SLSS=1; domain=www.windowsphone.com; path=/; HttpOnly X-Powered-By: ASP.NET X-Server: SN2CONXWWBA06 Date: Tue, 08 Nov 2011 09:41:05 GMT Connection: close Content-Length: 337 <html><head><title>Object moved</title></head><body> <h2>Object moved to <a href="https://login.live.com/login.srf?wa=wsignin1.0&rpsnv=11&checkda=1&ct=1320745265&rver=6.1.6195.0&wp=MBI&wreply=http:%2F%2Fwww.windowsphone.com%2Fen-US%2Fapps%3Flist%3Dfree&lc=1033&id=268289">here</a>.</h2> </body></html>
Thus, the server returns 302, which is the HTTP status code for redirection, and thus offers the βbrowserβ to open the URL passed in the Location header.
Netcat is a great tool for debugging and tracking all kinds of network communication and really helped me when I wanted to go deeper into the HTTP protocol.
source share