Changeset 18652 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2023-02-09T09:47:37+01:00 (23 months ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/HttpClient.java
r18437 r18652 34 34 import org.openstreetmap.josm.io.auth.DefaultAuthenticator; 35 35 import org.openstreetmap.josm.spi.preferences.Config; 36 import org.openstreetmap.josm.tools.TextUtils; 36 37 37 38 /** … … 126 127 127 128 /** 128 * Removed privacy related parts form output URL129 * @param url Unmodified URL130 * @return Stripped URL (privacy related issues removed)131 */132 private String stripUrl(URL url) {133 return url.toString().replaceAll("(token|key|connectId)=[^&]+", "$1=...stripped...");134 }135 136 /**137 129 * Opens the HTTP connection. 138 130 * @param progressMonitor progress monitor … … 158 150 final boolean hasReason = !Utils.isEmpty(reasonForRequest); 159 151 logRequest("{0} {1}{2} -> {3} {4} ({5}{6})", 160 getRequestMethod(), stripUrl(getURL()), hasReason ? (" (" + reasonForRequest + ')') : "",152 getRequestMethod(), TextUtils.stripUrl(getURL().toString()), hasReason ? (" (" + reasonForRequest + ')') : "", 161 153 cr.getResponseVersion(), cr.getResponseCode(), 162 154 stopwatch, … … 176 168 } 177 169 } catch (IOException | RuntimeException e) { 178 logRequest("{0} {1} -> !!! ({2})", requestMethod, stripUrl(url), stopwatch);170 logRequest("{0} {1} -> !!! ({2})", requestMethod, TextUtils.stripUrl(url.toString()), stopwatch); 179 171 Logging.warn(e); 180 172 //noinspection ThrowableResultOfMethodCallIgnored -
trunk/src/org/openstreetmap/josm/tools/TextUtils.java
r16541 r18652 21 21 return url.replace("/", "/\u200b").replace("&", "&\u200b"); 22 22 } 23 24 /** 25 * Remove privacy related parts form output URL 26 * @param url Unmodified URL 27 * @return Stripped URL (privacy related issues removed) 28 * @since 18652 29 */ 30 public static String stripUrl(String url) { 31 return url.replaceAll("(token|key|connectId)=[^&]+", "$1=...stripped..."); 32 } 33 23 34 }
Note:
See TracChangeset
for help on using the changeset viewer.