Ignore:
Timestamp:
2018-12-02T18:35:04+01:00 (5 years ago)
Author:
Don-vip
Message:

fix #17060, see #16073 - Support Internationalized domain names (IDN)

This allows JOSM to accesss https://öpnvkarte.de

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/HttpClient.java

    r14214 r14496  
    1313import java.net.CookieManager;
    1414import java.net.HttpURLConnection;
     15import java.net.MalformedURLException;
    1516import java.net.URL;
    1617import java.nio.charset.StandardCharsets;
     
    3031
    3132import org.openstreetmap.josm.data.Version;
     33import org.openstreetmap.josm.data.validation.routines.DomainValidator;
    3234import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
    3335import org.openstreetmap.josm.gui.progress.ProgressMonitor;
     
    7880
    7981    private HttpClient(URL url, String requestMethod) {
    80         this.url = url;
     82        try {
     83            String host = url.getHost();
     84            String asciiHost = DomainValidator.unicodeToASCII(host);
     85            this.url = asciiHost.equals(host) ? url : new URL(url.getProtocol(), asciiHost, url.getPort(), url.getFile());
     86        } catch (MalformedURLException e) {
     87            throw new JosmRuntimeException(e);
     88        }
    8189        this.requestMethod = requestMethod;
    8290        this.headers.put("Accept-Encoding", "gzip");
Note: See TracChangeset for help on using the changeset viewer.