- Timestamp:
- 2016-03-05T21:36:33+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java
r9913 r9935 7 7 import java.io.IOException; 8 8 import java.lang.reflect.Field; 9 import java.net.CookieHandler; 9 10 import java.net.HttpURLConnection; 11 import java.net.URISyntaxException; 10 12 import java.net.URL; 11 13 import java.nio.charset.StandardCharsets; 14 import java.util.Collections; 12 15 import java.util.HashMap; 13 16 import java.util.Iterator; … … 199 202 } 200 203 201 protected SessionId extractOsmSession() { 202 List<String> setCookies = connection.getResponse().getHeaderFields().get("Set-Cookie"); 204 protected SessionId extractOsmSession() throws IOException, URISyntaxException { 205 // response headers might not contain the cookie, see #12584 206 final List<String> setCookies = CookieHandler.getDefault() 207 .get(connection.getURL().toURI(), Collections.<String, List<String>>emptyMap()) 208 .get("Cookie"); 203 209 if (setCookies == null) { 204 210 Main.warn("No 'Set-Cookie' in response header!"); … … 267 273 tr("OSM website did not return a session cookie in response to ''{0}'',", url.toString())); 268 274 return sessionId; 269 } catch (IOException e) {275 } catch (IOException | URISyntaxException e) { 270 276 throw new OsmOAuthAuthorizationException(e); 271 277 } finally { -
trunk/src/org/openstreetmap/josm/tools/HttpClient.java
r9915 r9935 9 9 import java.io.InputStream; 10 10 import java.io.OutputStream; 11 import java.net.CookieHandler; 12 import java.net.CookieManager; 11 13 import java.net.HttpRetryException; 12 14 import java.net.HttpURLConnection; … … 51 53 private transient HttpURLConnection connection; // to allow disconnecting before `response` is set 52 54 private transient Response response; 55 56 static { 57 CookieHandler.setDefault(new CookieManager()); 58 } 53 59 54 60 private HttpClient(URL url, String requestMethod) {
Note:
See TracChangeset
for help on using the changeset viewer.