[ptt-users] Redirects

Frank Cohen fcohen at pushtotest.com
Sun Apr 15 18:45:40 PDT 2007


Hi Dan: This is an interesting issue. TestMaker 4.4.1 changed the way  
the HTTPProtocolHandler handles redirects. Here's a snippet from the  
4.4.1 release notes:


- WebObjects and Microsoft IIS users have occassionally found these  
servers returning HTTP redirect response codes with a relative URI.  
RFC 2116 section 14.30 requires the location header to be an absolute  
URI. According to the RFC relative URIs must only be sent using the  
META refresh tag. The TestMaker team does not want TestMaker to be a  
traffic cop for implementations of RFC 2116. So TestMaker 4.4.1  
HTTPProtocol has a special check for the relative URI on redirect  
(HTTP response code 302) and adds the domain name itself from the  
original POST. TestMaker scripts must use the  
http_protocol_handler.connect(1) form to follow redirects. Recorded  
scripts do not automatically add the (1) parameter. Thanks to Aaron  
Romeo, Dominique de Waleffe, and Kevin Dyer for participating in  
developing the solution.


We did not make any provisions for redirects that change protocols,  
including changing from http to https. Do you know what the RFC says  
about redirecting to a different protocol?

Secondly, we did not make any provision for changing the agentbase.py  
library to support the new redirect behavior. I'm happy to do so for  
the upcoming maintenance release of TestMaker 4.4.2.

Do you have any preferences for what the method would look like in a  
Jython script calling the Post method?

-Frank


On Apr 9, 2007, at 9:44 AM, Dan Scarf wrote:

> Hi,
>
> I’m working with a test case that uses useragentbase.py. It’s a  
> test case I generated by capturing from a Web browser via the  
> ‘record’ wizard.
>
>
>
> I’ve since stripped out the initial stuff in runTest (I just  
> visited google.com, simply to get the structure of the test  
> generated). I then added my own code in the runTest section.
>
>
>
> I’m initializing the test like so:
>
>
>
> test = CreateUserTestCase( 3, 'console file xml ', 1, '20.|300|301| 
> 302|303|304|307|401|403|408|41.', 'log.xml', 0, 0, 0, 1, 1,  
> 'CreateUserTestCase', 1 )
>
>
>
> I’m running into an issue whereby to get to the redirected url I  
> have to do this:
>
>
>
>         self.post( '''http://'''+self.hostName+'''/servlet/ 
> NewCustomer''', self.params)
>
>
>
>         self.redirectUrl = re.sub("https", "http",  
> self.response.getParameterValue("Location"))
>
>         self.post(self.redirectUrl)
>
>
>
> The code doesn’t seem to respect the setting to follow redirects.
>
>
>
> Any help would be appreciated.
>
>
>
> Thanks,
>
> -Dan
>
> CONFIDENTIALITY NOTICE: This email and any attachments thereto may  
> contain information which is privileged and confidential, and is  
> intended for the sole use of the recipient(s) named above. Any use  
> whatsoever of the information contained herein (including, but not  
> limited to, total or partial reproduction, communication or  
> distribution in any form) by persons other than the designated  
> recipient(s) is strictly prohibited. If you have received this  
> email in error, please notify the sender either by telephone, by  
> email, or by any other written or telephonic means, and delete the  
> material from any computer. Thank you for your cooperation.
> _______________________________________________
> Users mailing list
> Users at lists.pushtotest.com
> http://lists.pushtotest.com/mailman/listinfo/users



--
Frank Cohen, PushToTest, http://www.PushToTest.com, phone 408 374 7426
TestMaker: The open-source SOA test automation tool





More information about the Users mailing list