jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marek Ruszczak" <>
Subject Http Proxy server where parsing is done? Trying fix unwise characters
Date Mon, 26 Nov 2012 10:31:33 GMT

Sometimes ago I've reported a bug:
Now I'm trying to fix it myself.
In general I need that someone who will point out location in code which is
responsible for parsing of requests in Http Proxy Server, since simple call
stack analysis is not enough and I'm still not familiar with JMeter code.

What is my problem in details:
The main problem is handling of unwise characters (see RFC 2396
First of All I've corrected, here is patch content (this
was easy step):

---	(revision 1412901)
+++	(working copy)
@@ -228,7 +228,14 @@
         HttpRequestBase httpRequest = null;
         try {
-            URI uri = url.toURI();
+            URI uri = new URI(url.getProtocol(), 
+                              null /*userInfo*/,
+                              url.getHost(), 
+                              url.getPort(), 
+                              url.getFile(), 
+                              null /*query*/, 
+                              null /*fragment*/);
             if (method.equals(HTTPConstants.POST)) {
                 httpRequest = new HttpPost(uri);
             } else if (method.equals(HTTPConstants.PUT)) {

This makes conversion from URL to URI to work for unwise characters and this
part is definitely one step closer to proper solution,
But now manifestation of error has a different nature: an exception is
thrown and it comes from (here is a patch which improves logs): 

---	(revision 1412901)
+++	(working copy)
@@ -246,7 +253,10 @@
             } else if (method.equals(HTTPConstants.PATCH)) {
                 httpRequest = new HttpPatch(uri);
             } else {
-                throw new IllegalArgumentException("Unexpected method:
+                throw new
IllegalArgumentException(String.format("Unexpected method: \"%s\" for url:
\"%s\" frameDepth=%d", 
+                                                                 method,
             setupRequest(url, httpRequest, res); // can throw IOException
         } catch (Exception e) {

Problem here is that some call of "HTTPHC4Impl.sample" has wrong parameters,
in exception description I see:
   "Unexpected method: "" for url: "http:/" frameDepth=0"
This means that:
   "method" contains empty string
   "url" contains incomplete url "http:/" (yes there is one slash only it is
not typo).
   "frameDepth" is 0

IMO this indicates that parsing in HTTP Proxy Server failed completely.
Apparently destination server receives corrupted request, since my browser
receives a page with message failure as a page content.
Now I've tried to locate source of this problem but as I wrote at beginning
this code is new for me and simple call stack analysis is not enough in this
Somewhere properties of are set incorrectly because of failed parsing.
Now I need that someone who will just point out which part of code should I
look at!
For someone who knows JMeter code well it should be 5-10 minutes for me it
can be couple days.
I will also appreciate any additional comments.

Of course when I manage to do the proper fix I will share it immediately.


Marek Ruszczak

View raw message