|
22 | 22 | import java.util.Map; |
23 | 23 | import java.util.stream.Collectors; |
24 | 24 | import org.apache.commons.io.IOUtils; |
25 | | -import org.apache.http.HttpEntity; |
26 | | -import org.apache.http.HttpHost; |
27 | | -import org.apache.http.NameValuePair; |
28 | | -import org.apache.http.StatusLine; |
| 25 | +import org.apache.http.*; |
29 | 26 | import org.apache.http.client.config.RequestConfig; |
30 | 27 | import org.apache.http.client.methods.*; |
31 | 28 | import org.apache.http.entity.InputStreamEntity; |
@@ -105,16 +102,17 @@ public Response execute(Request in) throws IOException { |
105 | 102 | private URL getTargetUrl(HttpContext context) { |
106 | 103 | try { |
107 | 104 | HttpHost targetHost = (HttpHost) context.getAttribute("http.target_host"); |
108 | | - HttpUriRequest request = (HttpUriRequest) context.getAttribute("http.request"); |
109 | | - URI uri = |
| 105 | + HttpRequest request = (HttpRequest) context.getAttribute("http.request"); |
| 106 | + URI uri = new URI(request.getRequestLine().getUri()); |
| 107 | + uri = |
110 | 108 | new URI( |
111 | 109 | targetHost.getSchemeName(), |
112 | 110 | null, |
113 | 111 | targetHost.getHostName(), |
114 | 112 | targetHost.getPort(), |
115 | | - request.getURI().getPath(), |
116 | | - request.getURI().getQuery(), |
117 | | - request.getURI().getFragment()); |
| 113 | + uri.getPath(), |
| 114 | + uri.getQuery(), |
| 115 | + uri.getFragment()); |
118 | 116 | return uri.toURL(); |
119 | 117 | } catch (MalformedURLException | URISyntaxException e) { |
120 | 118 | throw new DatabricksException("Unable to get target URL", e); |
|
0 commit comments