You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2013/02/11 23:30:07 UTC
svn commit: r1444983 -
/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
Author: pmouawad
Date: Mon Feb 11 22:30:06 2013
New Revision: 1444983
URL: http://svn.apache.org/r1444983
Log:
Add URL concerned by certificate refusal if available
Modified:
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java?rev=1444983&r1=1444982&r2=1444983&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java Mon Feb 11 22:30:06 2013
@@ -175,6 +175,7 @@ public class Proxy extends Thread {
SampleResult result = null;
HeaderManager headers = null;
HTTPSamplerBase sampler = null;
+ String[] param = null;
try {
// Now, parse only first line
request.parse(new BufferedInputStream(clientSocket.getInputStream()));
@@ -186,7 +187,7 @@ public class Proxy extends Thread {
outStreamClient.write(("HTTP/1.0 200 OK\r\n\r\n").getBytes(SampleResult.DEFAULT_HTTP_ENCODING)); // $NON-NLS-1$
outStreamClient.flush();
// With ssl request, url is host:port (without https:// or path)
- String[] param = request.getUrl().split(":"); // $NON-NLS-1$
+ param = request.getUrl().split(":"); // $NON-NLS-1$
if (param.length == 2) {
log.debug("Start to negotiate SSL connection, host: " + param[0]);
clientSocket = startSSL(clientSocket, param[0]);
@@ -228,7 +229,8 @@ public class Proxy extends Thread {
"<a href=\"http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Proxy_Server\">HTTP Proxy Server documentation</a>"));
result = generateErrorResult(result, e); // Generate result (if nec.) and populate it
} catch (IOException ioe) {
- log.error("Problem with SSL certificate? Ensure browser is set to accept the JMeter proxy cert: "+ioe.getLocalizedMessage(), ioe);
+ log.error("Problem with SSL certificate? Ensure browser is set to accept the JMeter proxy cert: "+ioe.getLocalizedMessage()+" for url:" +
+ (param != null && param.length>0 ? param[0] : ""), ioe);
// won't work: writeErrorToClient(HttpReplyHdr.formInternalError());
if (result == null) {
result = new SampleResult();
Re: svn commit: r1444983 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
Posted by sebb <se...@gmail.com>.
On 11 February 2013 22:30, <pm...@apache.org> wrote:
> Author: pmouawad
> Date: Mon Feb 11 22:30:06 2013
> New Revision: 1444983
>
> URL: http://svn.apache.org/r1444983
> Log:
> Add URL concerned by certificate refusal if available
>
> Modified:
> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
>
> Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
> URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java?rev=1444983&r1=1444982&r2=1444983&view=diff
> ==============================================================================
> --- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java (original)
> +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java Mon Feb 11 22:30:06 2013
> @@ -175,6 +175,7 @@ public class Proxy extends Thread {
> SampleResult result = null;
> HeaderManager headers = null;
> HTTPSamplerBase sampler = null;
> + String[] param = null;
Could use empty array here:
String[] param = new String[0]; // or
org.apache.commons.lang3.ArrayUtils.EMPTY_STRING_ARRAY
Or even
String[] param = {""};
> try {
> // Now, parse only first line
> request.parse(new BufferedInputStream(clientSocket.getInputStream()));
> @@ -186,7 +187,7 @@ public class Proxy extends Thread {
> outStreamClient.write(("HTTP/1.0 200 OK\r\n\r\n").getBytes(SampleResult.DEFAULT_HTTP_ENCODING)); // $NON-NLS-1$
> outStreamClient.flush();
> // With ssl request, url is host:port (without https:// or path)
> - String[] param = request.getUrl().split(":"); // $NON-NLS-1$
> + param = request.getUrl().split(":"); // $NON-NLS-1$
> if (param.length == 2) {
> log.debug("Start to negotiate SSL connection, host: " + param[0]);
> clientSocket = startSSL(clientSocket, param[0]);
> @@ -228,7 +229,8 @@ public class Proxy extends Thread {
> "<a href=\"http://jmeter.apache.org/usermanual/component_reference.html#HTTP_Proxy_Server\">HTTP Proxy Server documentation</a>"));
> result = generateErrorResult(result, e); // Generate result (if nec.) and populate it
> } catch (IOException ioe) {
> - log.error("Problem with SSL certificate? Ensure browser is set to accept the JMeter proxy cert: "+ioe.getLocalizedMessage(), ioe);
> + log.error("Problem with SSL certificate? Ensure browser is set to accept the JMeter proxy cert: "+ioe.getLocalizedMessage()+" for url:" +
> + (param != null && param.length>0 ? param[0] : ""), ioe);
Then would not need the null check here.
For the second alternative would not need the length check either.
Not a big deal.
It's almost always better to use an empty array (which is immutable
and shareable) as it simplifies coding later.
> // won't work: writeErrorToClient(HttpReplyHdr.formInternalError());
> if (result == null) {
> result = new SampleResult();
>
>