URL encoding in Grinder 3

Grinder 3 is awesome no doubt about it!

Grinder 3 also adheres to W3C recommendations to encode requests as if everything is in UTF-8, meaning that if you pass parameter values in other than UTF-8 encoding then Grinder will send garbage. This is hardcoded and can be seen in the Grinder 3 source (god bless open source … amen). The explanation is also a comment from the source.

The only way to make Grinder 3 to encode requests using the deprecated way is to follow this procedure:

  1. Get the Grinder source from here
  2. Extract it
  3. Find the class HTTPClient.Codecs
  4. Lines #667 and #695 have the interesting code
  5. Open a simple Java project in your favored IDE which is Eclipse of course
  6. Create the package HTTPClient
  7. Put the Codecs class in it
  8. Add grinder.jar to the Build Path
  9. Modify lines #667 and #695 as you see fit.
  10. Pickup the compiled .class from bin directory of the project
  11. Put the .class file inside the grinder.jar which you are using
  12. Use it

This will make TCPProxy to record correctly non-UTF8 request bodies, enable to send a request with parameters encoded in anything.

Enjoy!

http://blog.javarnd.com/wp-content/plugins/sociofluid/images/digg_24.png http://blog.javarnd.com/wp-content/plugins/sociofluid/images/reddit_24.png http://blog.javarnd.com/wp-content/plugins/sociofluid/images/dzone_24.png http://blog.javarnd.com/wp-content/plugins/sociofluid/images/stumbleupon_24.png http://blog.javarnd.com/wp-content/plugins/sociofluid/images/delicious_24.png http://blog.javarnd.com/wp-content/plugins/sociofluid/images/blinklist_24.png http://blog.javarnd.com/wp-content/plugins/sociofluid/images/blogmarks_24.png http://blog.javarnd.com/wp-content/plugins/sociofluid/images/furl_24.png http://blog.javarnd.com/wp-content/plugins/sociofluid/images/newsvine_24.png http://blog.javarnd.com/wp-content/plugins/sociofluid/images/technorati_24.png http://blog.javarnd.com/wp-content/plugins/sociofluid/images/magnolia_24.png http://blog.javarnd.com/wp-content/plugins/sociofluid/images/google_24.png http://blog.javarnd.com/wp-content/plugins/sociofluid/images/facebook_24.png http://blog.javarnd.com/wp-content/plugins/sociofluid/images/twitter_24.png
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.