From 047b56833ccd293ab8f9b1f61460d6d4cc1075da Mon Sep 17 00:00:00 2001 From: Dave Roberge Date: Thu, 21 Apr 2016 08:15:14 -0400 Subject: [PATCH] Redact the full url in AsyncCall thread name. We don't want to accidentally leak sensitive information that may be embedded in the url. --- okhttp/src/main/java/okhttp3/RealCall.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/okhttp/src/main/java/okhttp3/RealCall.java b/okhttp/src/main/java/okhttp3/RealCall.java index 58814d53f899..f648d65ca79f 100644 --- a/okhttp/src/main/java/okhttp3/RealCall.java +++ b/okhttp/src/main/java/okhttp3/RealCall.java @@ -96,7 +96,7 @@ final class AsyncCall extends NamedRunnable { private final boolean forWebSocket; private AsyncCall(Callback responseCallback, boolean forWebSocket) { - super("OkHttp %s", originalRequest.url().toString()); + super("OkHttp %s", redactedUrl().toString()); this.responseCallback = responseCallback; this.forWebSocket = forWebSocket; } @@ -151,8 +151,11 @@ RealCall get() { */ private String toLoggableString() { String string = canceled ? "canceled call" : "call"; - HttpUrl redactedUrl = originalRequest.url().resolve("/..."); - return string + " to " + redactedUrl; + return string + " to " + redactedUrl(); + } + + HttpUrl redactedUrl() { + return originalRequest.url().resolve("/..."); } private Response getResponseWithInterceptorChain(boolean forWebSocket) throws IOException {