So you went ahead and did a little change to your web site, or web server redirect,
and you want to test it out without a sniffer,
the fastest way to test the http server headers and output is from the command line so you can see exactly what the servers is sending.
Now from Linux you have built in tools like GET, and wget ad curl,
wget and curl you can also install on windows to work from the command line.
Curl For Windows
Go ahead and download curl from their main website, you should get the Win32 – General version,
or the Win64 binary.
Better take the SSL enabled version if you will ever need to test SSL.
Take the curl.exe file from the zip file and place it somewhere in your windows PATH.
To find which directories are already in the windows path open the command line and write:
You will get the listing for such directories, just place the curl.exe in one of them.
Now for the tests:
To get only the headers and not the file contents itself use “curl -I http://address”
C:\>curl -I http://some.site.com/blocked_folder/blocked.php
HTTP/1.0 403 Forbidden
Expires: Tue, 27 Oct 2009 19:32:38 GMT
Cache-Control: max-age=0, no-cache, no-store
Date: Tue, 27 Oct 2009 19:32:38 GMT
From this test you can see the file is forbidden, what are the caching setings for the server, and other headers information.
If you would like to see the full page contents just remove the “-I”.
C:\>curl -I http://www.cisco.com/
HTTP/1.1 200 OK
Date: Tue, 27 Oct 2009 19:36:28 GMT
Set-Cookie: CP_GUTC=22.214.171.124.123463458258569; path=/; expires=Sat, 21-Oct-34 19:36:28 GMT; domain=.cisco.com
Last-Modified: Tue, 27 Oct 2009 16:34:14 GMT
this time we got a 200 reply which means the apache sent us the page,
we can see the page’s size from the “Content-Length” header,
and the other info the apache wants to send us.
Testing for Virtual hosts
Virtual hosting on apache can mean having more domain names on the same IP,
and you can test each of these domains by adding a “Host” header to the curl test line:
curl -H “Host: sub1.host.com” http://www.hosting.com/
curl -H “Host: sub2.host.com” http://www.hosting.com/
These 2 lines will bring back the html code for each of the different virtual hosts on the same server.
Here are some more ideas of using curl -for example:
Sending POST data through curl