[ grinder-Bugs-3524364 ] TCPProxy 3.8 Creates incorrect code for large POSTs

SourceForge.net <[email protected]> Tue, 18 Sep 2012 14:56:47 -0700
Newsgroups gmane.comp.java.grinder.devel
Message-ID <[email protected]>
Bugs item #3524364, was opened at 2012-05-07 08:05
Message generated for change (Settings changed) made by philipa
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=118598&aid=3524364&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: TCPProxy
Group: None
>Status: Closed
Resolution: Duplicate
Priority: 5
Private: No
Submitted By: Ouray Viney (oviney)
Assigned to: Philip Aston (philipa)
Summary: TCPProxy 3.8 Creates incorrect code for large POSTs

Initial Comment:
Recorded a test with 3.8 and when I tried to execute the script
without making any changes, I got the following error (see snippet
below).

2012-02-15 17:28:32,493 ERROR v3500-vineyo-0 thread-0 [ run-0 ]:
Aborted run: Jython exception: <type 'exceptions.TypeError'>: POST():
4th arg can't be coerced to boolean [calling TestRunner]
net.grinder.scriptengine.jython.JythonScriptExecutionException: <type
'exceptions.TypeError'>: POST(): 4th arg can't be coerced to boolean
       result = request2001.POST('/some/path/to/something/create' +
       File "C:\workspace\ART\recordings\16058.py", line 480, in page20
       self.page20()     # POST create (requests 2001-2046)
       File "C:\workspace\ART\recordings\16058.py", line 680, in __call__

Here is the generated code:

def page20(self):
   """POST create (requests 2001-2046)."""
   result=None
   self.token_autoScroll = \
     '0,0'
   self.token_javaxfacesViewState = \
     'v1Dxx9hSieZwMVPzZZHAPSkIfrSZM1jbO4mNTTN2U0GpxoAFjzFhwBfq8TSsy8Fpg/TQVOb0+Oiq+zJDdF6NVN/7aOKaI58tV2Aq1ShX7tQ='

   # Expecting 302 'Moved Temporarily'
   result = request2001.POST('/something/over/here/create' +
     '?execution=' +
     self.token_execution,
     ( NVPair('CreateTicket:postalCode', 'K2K 3N5'),
       NVPair('autoScroll', self.token_autoScroll),
       NVPair('CreateTicket:MOBO', ''),
       NVPair('CreateTicket:movingDate', '2012/02/14'),
       NVPair('CreateTicket:continue.x', '48'),
       NVPair('CreateTicket:continue.y', '10'),
       NVPair('CreateTicket_SUBMIT', '1'),
       NVPair('javax.faces.ViewState', self.token_javaxfacesViewState), ),
     ( NVPair('CreateTicket:postalCode', 'K2K 3N5'),
       NVPair('autoScroll', self.token_autoScroll),
       NVPair('CreateTicket:MOBO', ''),
       NVPair('CreateTicket:movingDate', '2012/02/14'),
       NVPair('CreateTicket:continue.x', '48'),
       NVPair('CreateTicket:continue.y', '10'),
       NVPair('CreateTicket_SUBMIT', '1'),
       NVPair('javax.faces.ViewState', self.token_javaxfacesViewState), ),
     ( NVPair('Content-Type', 'application/x-www-form-urlencoded'),
       httpUtilities.basicAuthorizationHeader('cpouser', 'CPOu53r'), ))
   self.token_execution = \
     httpUtilities.valueFromLocationURI('execution') # 'e2s2'

   request2002.GET('/something/over/here/create' +
     '?execution=' +
     self.token_execution, None,
     ( httpUtilities.basicAuthorizationHeader('cpouser', 'CPOu53r'), ))
   # 2 different values for token_mode found in response; the first matched
   # the last known value of token_mode - don't update the variable.

   return result

Here is the same method recorded with Grinder 3.4:

def page16(self):
   """POST create (requests 1601-1602)."""
   result=None
   self.token_javaxfacesViewState = \
     'v1Dxx9hSieZwMVPzZZHAPSkIfrSZM1jbO4mNTTN2U0GpxoAFjzFhwEssO/Z0p/uzbvKU911yLbSq+zJDdF6NVCJ26sWnV8yXnx+/NyzHnuM072oC245y6Q=='

   # Expecting 302 'Moved Temporarily'
   result = request1601.POST('/something/over/here/create' +
     '?execution=' +
     self.token_execution,
     ( NVPair('addressAndContact:userAddress:streetNumberSuffix', ''),
       NVPair('addressAndContact:userAddress:unit', ''),
       NVPair('addressAndContact:userAddress:postalCode', 'K1A 0B1'),
       NVPair('addressAndContact:misdevContact:businessLegalName',
'Functional Tester'),
       NVPair('addressAndContact:misdevContact:operatingName', ''),
       NVPair('addressAndContact:misdevContact:firstName', 'Functional'),
       NVPair('addressAndContact:misdevContact:lastName', 'Tester'),
       NVPair('addressAndContact:misdevContact:emailAddress',
'[email protected]'),
       NVPair('addressAndContact:misdevContact:phoneNumber', '6132345678'),
       NVPair('addressAndContact:misdevContact:extensionN', ''),
       NVPair('addressAndContact:misdevContact:languagePref', 'E'),
       NVPair('addressAndContact:continue.x', '25'),
       NVPair('addressAndContact:continue.y', '11'),
       NVPair('autoScroll', self.token_autoScroll),
       NVPair('addressAndContact_SUBMIT', '1'),
       NVPair('javax.faces.ViewState', self.token_javaxfacesViewState), ),
     ( NVPair('Content-Type', 'application/x-www-form-urlencoded'),
       httpUtilities.basicAuthorizationHeader('cpouser', 'CPOu53r'), ))
   self.token_execution = \
     httpUtilities.valueFromLocationURI('execution') # 'e2s3'

   request1602.GET('/something/over/here/create' +
     '?execution=' +
     self.token_execution, None,
     ( httpUtilities.basicAuthorizationHeader('cpouser', 'CPOu53r'), ))
   # 2 different values for token_mode found in response; the first matched
   # the last known value of token_mode - don't update the variable.

   return result

>From what I can see, there is an extra NVPAIR definition and by
reviewing the API docs for the POST() method, there is no instance
where the POST takes three NVPAIRs.

Here is the method signature:

 HTTPResponse   POST(java.lang.String uri, NVPair[] formData, NVPair[]
headers, boolean isMultipart)
         Makes an HTTP POST request.

In conclusion, I adjusted the dodgy POSTs (that had 3 NVPAIR definitions) re-ran the script and had no issues.


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

Comment By: Philip Aston (philipa)
Date: 2012-05-11 01:06

Message:
Yes - dup of 3511553.

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

Comment By: Ouray Viney (oviney)
Date: 2012-05-10 22:38

Message:
This has been fixed in versions > 3.8.  I will be happy to re-test this
with an official build (if required).

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

Comment By: Ouray Viney (oviney)
Date: 2012-05-09 10:43

Message:
I checked out a copy from git and built locally.  In this version, the
problem is no longer present.  I will be happy to test a official build
when one is ready.

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

Comment By: Ouray Viney (oviney)
Date: 2012-05-07 09:11

Message:
Upon further investigation of this issue, it appears that the issue is that
TCPProxy incorrectly duplicates NVPairs in the POST.



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

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

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/