Skip to content

Commit

Permalink
Don't allow httpclient to normalize URIs aws#1919
Browse files Browse the repository at this point in the history
  • Loading branch information
akhaku committed Jul 2, 2019
1 parent a514e16 commit 7842379
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.apache.http.auth.NTCredentials;
import org.apache.http.client.AuthCache;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.entity.BufferedHttpEntity;
Expand Down Expand Up @@ -137,6 +138,12 @@ public static HttpClientContext newClientContext(HttpClientSettings settings,
addPreemptiveAuthenticationProxy(clientContext, settings);

clientContext.setAttribute(HttpContextUtils.DISABLE_SOCKET_PROXY_PROPERTY, settings.disableSocketProxy());
try {
// don't normalize URIs - the default behavior before httpclient 4.5.7
clientContext.setRequestConfig(RequestConfig.custom().setNormalizeUri(false).build());
} catch (NoSuchMethodError e) {
// this method was added in httpclient 4.5.8
}
return clientContext;

}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
the aggregate ZIP artifact -->
<javax.mail.version>1.4.6</javax.mail.version>
<jre.version>1.6</jre.version>
<httpcomponents.httpclient.version>4.5.5</httpcomponents.httpclient.version>
<httpcomponents.httpclient.version>4.5.9</httpcomponents.httpclient.version>
<!-- These properties are used by cucumber tests related code -->
<cucumber.info.cukes.version>1.2.4</cucumber.info.cukes.version>
<cucumber.guice.version>4.0</cucumber.guice.version>
Expand Down

0 comments on commit 7842379

Please sign in to comment.