Skip to content

Commit

Permalink
request may not be a HttpUriRequest when using a proxy (#850)
Browse files Browse the repository at this point in the history
  • Loading branch information
Athou committed Oct 12, 2017
1 parent 2bccee2 commit 86835ee
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main/java/com/commafeed/backend/HttpGetter.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,13 @@ public HttpResult getBinary(String url, String lastModified, String eTag, int ti
contentType = entity.getContentType().getValue();
}
}
HttpUriRequest req = (HttpUriRequest) context.getRequest();
HttpHost host = context.getTargetHost();
String urlAfterRedirect = req.getURI().isAbsolute() ? req.getURI().toString() : host.toURI() + req.getURI();

String urlAfterRedirect = url;
if (context.getRequest() instanceof HttpUriRequest) {
HttpUriRequest req = (HttpUriRequest) context.getRequest();
HttpHost host = context.getTargetHost();
urlAfterRedirect = req.getURI().isAbsolute() ? req.getURI().toString() : host.toURI() + req.getURI();
}

long duration = System.currentTimeMillis() - start;
result = new HttpResult(content, contentType, lastModifiedHeaderValue, eTagHeaderValue, duration, urlAfterRedirect);
Expand Down

0 comments on commit 86835ee

Please sign in to comment.