jmeter-dev mailing list archives

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

Sometimes ago I've reported a bug:
https://issues.apache.org/bugzilla/show_bug.cgi?id=54142
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
http://tools.ietf.org/html/rfc2396#section-2.4.3).
First of All I've corrected HTTPHC4Impl.java, here is patch content (this
was easy step):

===================================================================
--- HTTPHC4Impl.java	(revision 1412901)
+++ HTTPHC4Impl.java	(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): 

===================================================================
--- HTTPHC4Impl.java	(revision 1412901)
+++ HTTPHC4Impl.java	(working copy)
@@ -246,7 +253,10 @@
             } else if (method.equals(HTTPConstants.PATCH)) {
                 httpRequest = new HttpPatch(uri);
             } else {
-                throw new IllegalArgumentException("Unexpected method:
"+method);
+                throw new
IllegalArgumentException(String.format("Unexpected method: \"%s\" for url:
\"%s\" frameDepth=%d", 
+                                                                 method,
+
url.toString(),
+
frameDepth));
             }
             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
case.
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.

BR,

Marek Ruszczak


Mime
View raw message