Piwigo-Android icon indicating copy to clipboard operation
Piwigo-Android copied to clipboard

Ok3httpdownloader

Open andyleadbetter opened this issue 4 years ago • 1 comments

There is a problem downloading images from Piwigo when the the server is sat behind a reverse proxy that terminates the https client connection, and requests images from Piwigo. The Piwigo server url base is https, but all image urls coming from the backend are http.

Most reverse proxies will redirect a request for the http image on the internet to a https request before hitting the backend. This patch changes the Picasso component to make use of a okhttp3 download agent per an implementation from Jake Wharton https://github.com/JakeWharton/picasso2-okhttp3-downloader/blob/master/LICENSE.txt

The change is actually just 3 lines on top of v1.0.2 release tag. but includes other changes to files from Android Studio.

There are no logic changes in Piwigo to support this, its a straight drop in of a different download engine to the Picasso framework, but this download engine supports graceful 302 & 301 redirects to the https URL returned from the proxy, without needing to handle it in the piwigo code.

andyleadbetter avatar Dec 11 '20 21:12 andyleadbetter

Thanks for your contribution! Before merging I have a few requests:

  • can you create a ticket (if not yet existing) that describes the issue before, instead of writing "There is a problem..." in a PR
  • check whether the issue is still present in the current HEAD of the development
  • rebase your PR on top of the current HEAD

ramack avatar Dec 12 '20 20:12 ramack