Skip to content

Commit

Permalink
Redact the full url in AsyncCall thread name.
Browse files Browse the repository at this point in the history
We don't want to accidentally leak sensitive information that may be
embedded in the url.
  • Loading branch information
dave-r12 committed Apr 21, 2016
1 parent b26ad3e commit 047b568
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions okhttp/src/main/java/okhttp3/RealCall.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 047b568

Please sign in to comment.