Piwigo / Piwigo-Android

Piwigo Native Android App
GNU General Public License v3.0
140 stars 43 forks source link

Ok3httpdownloader #261

Open andyleadbetter opened 3 years ago

andyleadbetter commented 3 years ago

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.

ramack commented 3 years ago

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