Ignore:
Timestamp:
2012-11-18T00:44:10+01:00 (12 years ago)
Author:
Don-vip
Message:

Single entry point in Utils to open HTTP connections

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/plugins/PluginDownloadTask.java

    r5266 r5587  
    119119            URL url = new URL(pi.downloadlink);
    120120            synchronized(this) {
    121                 downloadConnection = (HttpURLConnection)url.openConnection();
     121                downloadConnection = Utils.openHttpConnection(url);
    122122                downloadConnection.setRequestProperty("Cache-Control", "no-cache");
    123                 downloadConnection.setRequestProperty("User-Agent",Version.getInstance().getAgentString());
    124                 downloadConnection.setRequestProperty("Host", url.getHost());
    125123                downloadConnection.connect();
    126124            }
  • trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java

    r5266 r5587  
    162162            URL url = new URL(site);
    163163            synchronized(this) {
    164                 connection = (HttpURLConnection)url.openConnection();
     164                connection = Utils.openHttpConnection(url);
    165165                connection.setRequestProperty("Cache-Control", "no-cache");
    166                 connection.setRequestProperty("User-Agent",Version.getInstance().getAgentString());
    167                 connection.setRequestProperty("Host", url.getHost());
    168166                connection.setRequestProperty("Accept-Charset", "utf-8");
    169167            }
     
    211209            URL url = new URL(site);
    212210            synchronized(this) {
    213                 connection = (HttpURLConnection)url.openConnection();
     211                connection = Utils.openHttpConnection(url);
    214212                connection.setRequestProperty("Cache-Control", "no-cache");
    215                 connection.setRequestProperty("User-Agent",Version.getInstance().getAgentString());
    216                 connection.setRequestProperty("Host", url.getHost());
    217213            }
    218214            in = connection.getInputStream();
Note: See TracChangeset for help on using the changeset viewer.