[ grinder-Bugs-3497557 ] TCPProxy recording fails at re-creating urls with tokens

SourceForge.net <[email protected]> Sun, 25 Mar 2012 04:45:19 -0700
Newsgroups gmane.comp.java.grinder.devel
Message-ID <[email protected]>
Bugs item #3497557, was opened at 2012-03-06 04:54
Message generated for change (Comment added) made by philipa
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=118598&aid=3497557&group_id=18598

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: HTTP Plugin
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Anders Storsveen (bushwakko)
Assigned to: Philip Aston (philipa)
Summary: TCPProxy recording fails at re-creating urls with tokens

Initial Comment:
I have a case where a token is (correctly and automatically) discovered by the recorder via httpUtilities.valueFromLocationURI(). It also attemtps to create a later url which contains that token. However the token is never url encoded.

I confirmed this was the case by using urllib and the urlencode() method. This created a working url.

----------------------------------------------------------------------

>Comment By: Philip Aston (philipa)
Date: 2012-03-25 04:45

Message:
Analysis: The recording currently unencodes tokens. It relies on the
HTTPRequest method to re-encode URLs as required

Unfortunately, the generated script passes query string and path tokens by
concatenating up a single the path parameter. HTTPRequest does no further
processing on this parameter.

----------------------------------------------------------------------

Comment By: Philip Aston (philipa)
Date: 2012-03-15 02:53

Message:
It certianly helps. I'll put this on my queue, thanks.

----------------------------------------------------------------------

Comment By: Anders Storsveen (bushwakko)
Date: 2012-03-13 04:33

Message:
Was the code ok?

----------------------------------------------------------------------

Comment By: Anders Storsveen (bushwakko)
Date: 2012-03-09 01:36

Message:
This script is auto-generated:

  def page27(self):
    """GET verifyLoggedIn (request 2701)."""
    
    # Expecting 302 'Found'
    result = request2701.GET('/verifyLoggedIn')
    self.token_SAMLRequest = \
      httpUtilities.valueFromLocationURI('SAMLRequest') #
'nZLbTsMwDIZfpcp9l7Tr2hFtkwYTYhKHaRtccINC...'
    self.token_RelayState = \
      httpUtilities.valueFromLocationURI('RelayState') #
'https://staging.comoyo.no/verifyLoggedIn'

    return result

 def page32(self):
    """GET sso (requests 3201-3208)."""
    
    # Expecting 307 'Temporary Redirect'
    result = request3201.GET('/id/sso' +
      '?SAMLRequest=' +
      self.token_SAMLRequest +
      '&RelayState=' +
      self.token_RelayState)
    self.token_FlowState = \
      httpUtilities.valueFromLocationURI('FlowState') #
'cmVxdWVzdElkPV83NGMyMDYwNDkwOGE1NzQ3Y2Q5...'



Here is how I had to fix it:



  def page32(self):
    """GET sso (requests 3201-3208)."""
    
    # DEFINES FLOWSTATE HERE!
    print "Using Samlreq: " , self.token_SAMLRequest , " and relaystate: ",
self.token_RelayState

    samlReqEnc = urllib.urlencode(self.token_SAMLRequest)

    # Expecting 307 'Temporary Redirect'
    result = request32011.GET('/id/sso' +
      '?SAMLRequest=' +
      samlReqEnc +
      '&RelayState=' +
      self.token_RelayState)
    self.token_FlowState = \
      httpUtilities.valueFromLocationURI('FlowState') #
'cmVxdWVzdElkPV83NGMyMDYwNDkwOGE1NzQ3Y2Q5...'


----------------------------------------------------------------------

Comment By: Philip Aston (philipa)
Date: 2012-03-08 10:33

Message:
Please post an example of an incorrectly script. Thanks.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=118598&aid=3497557&group_id=18598

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure