Skip to content

Commit

Permalink
Fixed a bug when using proxy & debugging issue #6
Browse files Browse the repository at this point in the history
  • Loading branch information
kuniteru committed Jul 31, 2021
1 parent 74f0459 commit 6185dd7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion plugins/functions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>jp.co.pnop</groupId>
<artifactId>jmeter-plugins-functions-azure</artifactId>
<version>0.4.1</version>
<version>0.4.2</version>

<name>Custom JMeter functions for Azure</name>
<description>Custom JMeter functions for Azure</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ public synchronized String execute(SampleResult previousResult, Sampler currentS
accessToken = node.get("access_token").textValue();
addVariableValue(accessToken, values, NAME_OF_VAL);
} else {
log.info("Warn calling {} Azure AD request, Response status: {}, Response body {}", KEY, status, responseMessage);
String errorDescription = node.get("error_description").textValue();
log.warn("Warn calling {} Azure AD request, {}: {}", KEY, response.getStatusLine().toString(),
errorDescription);
log.info(responseMessage);
}
} catch (IllegalArgumentException e) {
log.error(
Expand All @@ -168,6 +168,10 @@ public synchronized String execute(SampleResult previousResult, Sampler currentS
log.error("Error calling {}, ", KEY, e);
} catch (IOException e) {
log.error("Error calling {}, ", KEY, e);
} catch (Exception e) {
log.error(
"Error calling {} function with Tenant ID {}, grant_type {}, client_id {}, username {}, scope {}, resource {}, aadVersion {}, aadUri {}, ",
KEY, tenantId, grantType, clientId, username, scope, resource, aadVersion, aadUri, e);
}

return accessToken;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public class common {

public static HttpClientBuilder setProxy(String host) {
HttpClientBuilder httpclientbuilder = HttpClientBuilder.create();
String targetHost = "login.microsoftonline.com";

String proxyHost = JMeterUtils.getPropDefault("https.proxyHost", "").trim();
int proxyPort = Integer.parseInt(JMeterUtils.getPropDefault("https.proxyPort", "3128").trim());
Expand All @@ -43,7 +42,7 @@ public static HttpClientBuilder setProxy(String host) {
}
NON_PROXY_HOST_SUFFIX_SIZE = nonProxyHostSuffix.size();

if (proxyHost.length() > 0 && !nonProxyHostFull.contains(targetHost) && !isPartialMatch(targetHost)) {
if (proxyHost.length() > 0 && !nonProxyHostFull.contains(host) && !isPartialMatch(host)) {
HttpHost proxy = new HttpHost(proxyHost, proxyPort);
DefaultProxyRoutePlanner routePlanner = new DefaultProxyRoutePlanner(proxy);
httpclientbuilder = httpclientbuilder.setRoutePlanner(routePlanner);
Expand Down

0 comments on commit 6185dd7

Please sign in to comment.