Changeset 6073 in josm


Ignore:
Timestamp:
2013-07-19T01:41:40+02:00 (11 years ago)
Author:
Don-vip
Message:

fix #8886 - Allow to download plugin jars redirected from https to http, like those hosted on github

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/MirroredInputStream.java

    r5926 r6073  
    259259     * <p>
    260260     * This can causes problems when downloading from certain GitHub URLs.
     261     *
     262     * @param downloadUrl The resource URL to download
     263     * @return The HTTP connection effectively linked to the resource, after all potential redirections
     264     * @throws MalformedURLException If a redirected URL is wrong
     265     * @throws IOException If any I/O operation goes wrong
     266     * @since 6073
    261267     */
    262     protected HttpURLConnection connectFollowingRedirect(URL downloadUrl) throws MalformedURLException, IOException {
     268    public static HttpURLConnection connectFollowingRedirect(URL downloadUrl) throws MalformedURLException, IOException {
    263269        HttpURLConnection con = null;
    264270        int numRedirects = 0;
  • trunk/src/org/openstreetmap/josm/plugins/PluginDownloadTask.java

    r6048 r6073  
    2222import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
    2323import org.openstreetmap.josm.gui.progress.ProgressMonitor;
     24import org.openstreetmap.josm.io.MirroredInputStream;
    2425import org.openstreetmap.josm.tools.CheckParameterUtil;
    2526import org.openstreetmap.josm.tools.Utils;
     
    119120            URL url = new URL(pi.downloadlink);
    120121            synchronized(this) {
    121                 downloadConnection = Utils.openHttpConnection(url);
    122                 downloadConnection.setRequestProperty("Cache-Control", "no-cache");
    123                 downloadConnection.connect();
     122                downloadConnection = MirroredInputStream.connectFollowingRedirect(url);
    124123            }
    125124            in = downloadConnection.getInputStream();
Note: See TracChangeset for help on using the changeset viewer.