Changeset 2222 in josm for trunk/src/org


Ignore:
Timestamp:
2009-10-02T21:15:44+02:00 (15 years ago)
Author:
stoecker
Message:

fixed #3580 - patch by bastiK - no longer send username/password for capabilities GET request

File:
1 edited

Legend:

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

    r2198 r2222  
    163163        initAuthentication();
    164164        try {
    165             String s = sendRequest("GET", "capabilities", null,monitor);
     165            String s = sendRequest("GET", "capabilities", null,monitor, false);
    166166            InputSource inputSource = new InputSource(new StringReader(s));
    167167            SAXParserFactory.newInstance().newSAXParser().parse(inputSource, new CapabilitiesParser());
     
    459459    }
    460460
     461    private String sendRequest(String requestMethod, String urlSuffix,String requestBody, ProgressMonitor monitor) throws OsmTransferException {
     462        return sendRequest(requestMethod, urlSuffix, requestBody, monitor, true);
     463    }
     464
    461465    /**
    462466     * Generic method for sending requests to the OSM API.
     
    474478     *    been exhausted), or rewrapping a Java exception.
    475479     */
    476     private String sendRequest(String requestMethod, String urlSuffix,String requestBody, ProgressMonitor monitor) throws OsmTransferException {
     480    private String sendRequest(String requestMethod, String urlSuffix,String requestBody, ProgressMonitor monitor, boolean doAuthenticate) throws OsmTransferException {
    477481        StringBuffer responseBody = new StringBuffer();
    478 
    479482        int retries = getMaxRetries();
    480483
     
    486489                activeConnection.setConnectTimeout(15000);
    487490                activeConnection.setRequestMethod(requestMethod);
    488                 addAuth(activeConnection);
     491                if (doAuthenticate) {
     492                    addAuth(activeConnection);
     493                }
    489494
    490495                if (requestMethod.equals("PUT") || requestMethod.equals("POST") || requestMethod.equals("DELETE")) {
Note: See TracChangeset for help on using the changeset viewer.