Ticket #8606: 8606.patch

File 8606.patch, 1.9 KB (added by stoecker, 13 years ago)
  • src/org/openstreetmap/josm/data/Version.java

     
    226226        }
    227227        return "JOSM/1.5 ("+ s+" "+LanguageInfo.getJOSMLocaleCode()+") " + Main.platform.getOSDescription();
    228228    }
     229
     230    /**
     231     * Returns the full User-Agent string
     232     * @return The User-Agent
     233     * @since 5866
     234     */
     235    public String getFullAgentString() {
     236        return getAgentString + " Java/"+System.getProperty("java.version");
     237    }
    229238}
  • src/org/openstreetmap/josm/io/imagery/WMSGrabber.java

     
    5050        if(layer.getInfo().getCookies() != null && !layer.getInfo().getCookies().equals("")) {
    5151            props.put("Cookie", layer.getInfo().getCookies());
    5252        }
     53        props.put("User-Agent", Version.getInstance().getFullAgentString()));
    5354        Pattern pattern = Pattern.compile("\\{header\\(([^,]+),([^}]+)\\)\\}");
    5455        StringBuffer output = new StringBuffer();
    5556        Matcher matcher = pattern.matcher(this.baseURL);
  • src/org/openstreetmap/josm/tools/Utils.java

     
    553553            throw new IllegalArgumentException("Invalid HTTP url");
    554554        }
    555555        HttpURLConnection connection = (HttpURLConnection) httpURL.openConnection();
     556        connection.setRequestProperty("User-Agent", Version.getInstance().getFullAgentString()));
    556557        return connection;
    557558    }
    558559