Hey dude , one of your servers is broken .Part-2
When it comes to to IIS versions, there was a major face lift starting with IIS6 and with that the resource kit got beefy too. For this post we will cover tinyget in the IIS 6 resource kit
if you are looking for a download location https://www.microsoft.com/downloads/en/details.aspx?FamilyID=56fc92ee-a71a-4c73-b628-ade629c89499\&displaylang=en
The best features of tinyget is
- You can control the headers that is passed (very handy if you want to do some specific user agent testing )
- You can check the status against an expected result .
- You can do Looping for requests.
- You can test the content body for strings.
- Test web pages that use SSL
- Test web pages that use authentication or client certificates.
the list goes on
Continuing from the earlier post we are going to look at how to test for Content-length if a server hosts multiple websites . Here we use a for loop to execute against a set of servers from temp.txt against www.site1.com on a server that hosts different sites
for /f %i in (C:\temp\server.txt) do @echo %i && @c:\tools\tinyget.exe -srv:%i -status:200 -uri:"/microsoft/foo.aspx" -rh:"Host: www.site1.com\r\nUser-Agent : Mozilla/4.0 (compatible; MSIE 7.0;Windows NT 5.1)\r\n" -h | findstr "Content-Length:"
web33
Content-Length: 60
web34
Content-Length: 60
web35
Content-Length: 60
web36
Content-Length: 60
web37
Content-Length: 60
web38
Content-Length: 60
web39
Content-Length: 22 (Broken)
Let us look at another example from the previous Part 1 post where one of you machines is serving a 404 and how to capture it with tiny get . it is easy , using the same example , you look for a status of 200 ok to single out the machine that is throwing 404
for /f %i in (C:\temp\server.txt) do @echo %i && @c:\tools\tinyget.exe -srv:%i -status:200 -uri:"/microsoft/foo.aspx" -rh:"Host: www.site1.com\r\nUser-Agent : Mozilla/4.0 (compatible; MSIE 7.0;Windows NT 5.1)\r\n"
web33
web34
web35
web36
web37
ERROR: 0x1 : Testcase number: 0 - Explain: (null)
ERROR: 0x4b8 : returned status code (404) does not match expected one (200)
ERROR: 0x1 : URI: /microsoft/foo.aspx, SSL: Nonsecure, CliCert:(null), Auth:Anon Domain:(null) User: (null) Password: (null)Received status/error info: 404 Not Found - HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had
If you are looking at looping a particular url against a a set of machines you can use same command with the highlighted options.
for /f %i in (C:\temp\server.txt) do @echo %i && @c:\tools\tinyget.exe -srv:%i -status:200 -uri:"/microsoft/foo.aspx" -rh:"Host: www.site1.com\r\nUser-Agent : Mozilla/4.0 (compatible; MSIE 7.0;Windows NT 5.1)\r\n" -x:10 -l:10
The above will run 10 threads each 10 times against each server for the url :"/microsoft/foo.aspx". This is not advised to stress test for stress testing you shoud use WCAT from the same resource kit or download from www.iis.net , but this is great in case you want debug some perf issues for a particular url .
Recently was dealing with a case where there was a typo on a page that was published out , suddenly the content publisher noticed it and reverted the changes . But while testing it he was seeing intermittently the page that had typo . This is what I did to isolate the issues to proxy cache ie, first prove none of my machines was serving the page that had typo .
for /f %i in (C:\temp\server.txt) do @echo %i && @c:\tools\tinyget.exe -srv:%i -status:200 -uri:"/microsoft/foo.aspx" -testcontainstring:"<correct string>" -rh:"Host: www.site1.com\r\nUser-Agent : Mozilla/4.0 (compatible; MSIE 7.0;Windows NT 5.1)\r\n"
if one of my servers was broken the below would have been my output
web37
ERROR: 0x4b8 : response body does not contain expected string
Expected:<correct string>
Received: <spew of the page content>
Finally if you are testing against a url that is secure (https) use the highligted option
for /f %i in (C:\temp\server.txt) do @echo %i && @c:\tools\tinyget.exe -srv:%i -status:200 -uri:"/microsoft/foo.aspx" -s:3-rh:"Host: www.site1.com\r\nUser-Agent : Mozilla/4.0 (compatible; MSIE 7.0;Windows NT 5.1)\r\n"
This concludes the 2 part series. In the next post we will cover some fun with permission for cert private keys.