| || |
How to reject http auto redirect?
I am testing a tomcat server for performance using shell scripts. I am using 'wget' command which hits the tomcat with the request for downloading a file, and tomcat redirects this request to some other address. But I dont want to get redirected, instead just want to hit the tomcat with request and read its redirect address(http), so I'm just testing its routing capability.
Is there any way to stop those redirects in 'wget' or can I use any other command for this purpose? Thanks.
Re: How to reject http auto redirect?
This is a fun one, have you tried writing a perl/java program to connect to the port (probably 80) and throw the following HTTP code:
GET /<your url here> HTTP/1.0\n\n
then read the text, that is your redirect, a simple script should capture it for you, though not wget.
I will try to insert some code here to make it more useful, to people who speak perl:
</font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">#create your connection to www.whatever.com:80 and give it a file handle
print CONNECTIONFH "GET $url HTTP/1.0\n\n";
print "redirected to $1" if( /^Location:\s+(.+)$/ );
}</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">