I couldn't figure out how to reopen bug 164. :) So, I'll submit a new issue...
The problem is that when the images are cached by the ttrss server itself, and
http auth is in use, the image fetching lacks the authorization to correctly
download.
For example, if the ttrss server is located at https://exmaple.com/tt-rss/ and
has feeds configured to cache locally (Edit feed / Options / Cache images
locally), then the images will be loaded from
https://example.com/tt-rss/image.php?hash=nnnnn...
When http authentication is used to reach https://exmaple.com/tt-rss/, the
image fetches to https://example.com/tt-rss/image.php?hash=nnnnn... currently
lack the required Authorization header.
I think something like this is needed in
ttrssreader/src/main/java/org/ttrssreader/utils/FileUtils.java, in class
FileUtils, in downloadToFile, just after this code happens:
URL url = new URL(downloadUrl);
URLConnection connection = url.openConnection();
I think something like the following is needed:
Controller controller = Controller.getInstance();
if (downloadUrl.startsWith(controller.url()) &&
controller.useHttpAuth()) {
String httpUsername = controller.httpUsername();
String httpPassword = controller.httpPassword();
String auth = Base64.encodeToString((httpUsername + ":" + httpPassword).getBytes("UTF-8"), Base64.NO_WRAP)
connection.setRequestProperty("Authorization", "Basic " + auth);
}
(This is based on code from net/JavaJSONConnector.java.)
Additionally, I couldn't tell if downloadToFile was the only way images were
fetched, though.
Thanks!
Original issue reported on code.google.com by plus.goo...@influx.outflux.net on 7 Feb 2015 at 8:23
Original issue reported on code.google.com by
plus.goo...@influx.outflux.net
on 7 Feb 2015 at 8:23