You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by se...@apache.org on 2013/08/17 19:17:22 UTC

svn commit: r1515022 - in /jmeter/trunk: src/protocol/http/org/apache/jmeter/protocol/http/sampler/ src/protocol/http/org/apache/jmeter/protocol/http/util/ xdocs/

Author: sebb
Date: Sat Aug 17 17:17:22 2013
New Revision: 1515022

URL: http://svn.apache.org/r1515022
Log:
Show IP source address in request data
Bugzilla Id: 55389

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPConstantsInterface.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java?rev=1515022&r1=1515021&r2=1515022&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java Sat Aug 17 17:17:22 2013
@@ -266,6 +266,11 @@ public class HTTPHC3Impl extends HTTPHCA
 
             int statusCode = client.executeMethod(httpMethod);
 
+            // We've finished with the request, so we can add the LocalAddress to it for display
+            final InetAddress localAddr = client.getHostConfiguration().getLocalAddress();
+            if (localAddr != null) {
+                httpMethod.addRequestHeader(HEADER_LOCAL_ADDRESS, localAddr.toString());
+            }
             // Needs to be done after execute to pick up all the headers
             res.setRequestHeaders(getConnectionHeaders(httpMethod));
 

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java?rev=1515022&r1=1515021&r2=1515022&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java Sat Aug 17 17:17:22 2013
@@ -296,7 +296,13 @@ public class HTTPHC4Impl extends HTTPHCA
                     executeRequest(httpClient, httpRequest, localContext, url);
 
             // Needs to be done after execute to pick up all the headers
-            res.setRequestHeaders(getConnectionHeaders((HttpRequest) localContext.getAttribute(ExecutionContext.HTTP_REQUEST)));
+            final HttpRequest request = (HttpRequest) localContext.getAttribute(ExecutionContext.HTTP_REQUEST);
+            // We've finished with the request, so we can add the LocalAddress to it for display
+            final InetAddress localAddr = (InetAddress) httpRequest.getParams().getParameter(ConnRoutePNames.LOCAL_ADDRESS);
+            if (localAddr != null) {
+                request.addHeader(HEADER_LOCAL_ADDRESS, localAddr.toString());
+            }
+            res.setRequestHeaders(getConnectionHeaders(request));
 
             Header contentType = httpResponse.getLastHeader(HTTPConstants.HEADER_CONTENT_TYPE);
             if (contentType != null){

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPConstantsInterface.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPConstantsInterface.java?rev=1515022&r1=1515021&r2=1515022&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPConstantsInterface.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPConstantsInterface.java Sat Aug 17 17:17:22 2013
@@ -55,6 +55,7 @@ public interface HTTPConstantsInterface 
     String HEADER_CONTENT_TYPE = "Content-Type"; // $NON-NLS-1$
     String HEADER_CONTENT_LENGTH = "Content-Length"; // $NON-NLS-1$
     String HEADER_HOST = "Host"; // $NON-NLS-1$
+    String HEADER_LOCAL_ADDRESS = "X-LocalAddress"; // $NON-NLS-1$ pseudo-header for reporting Local Address
     String HEADER_LOCATION = "Location"; // $NON-NLS-1$
     String APPLICATION_X_WWW_FORM_URLENCODED = "application/x-www-form-urlencoded"; // $NON-NLS-1$
     String MULTIPART_FORM_DATA = "multipart/form-data"; // $NON-NLS-1$

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1515022&r1=1515021&r2=1515022&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Sat Aug 17 17:17:22 2013
@@ -336,6 +336,7 @@ Previously the default was 1, which coul
 <li><bugzilla>54532</bugzilla> - Improve Response Time Graph Y axis scale with huge values or small values (&amp;lt; 1000ms). Add a new field to define increment scale. Contributed by Milamber based on patch by Luca Maragnani (luca.maragnani at gmail.com)</li>
 <li><bugzilla>54576</bugzilla> - View Results Tree : Add a CSS/JQuery Tester. Contributed by Philippe Mouawad</li>
 <li><bugzilla>54777</bugzilla> - Improve Performance of default ResultCollector. Contributed by Philippe Mouawad based on patch by Mikhail Epikhin (epihin-m at yandex.ru)</li>
+<li><bugzilla>55389</bugzilla> - Show IP source address in request data</li>
 </ul>
 
 <h3>Timers, Assertions, Config, Pre- &amp; Post-Processors</h3>