Skip to content

Commit 58b4273

Browse files
committed
Improve logging
1 parent 499c671 commit 58b4273

3 files changed

Lines changed: 3 additions & 17 deletions

File tree

src/main/java/io/split/android/client/network/ProxyCacertConnectionHandler.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ HttpResponse executeRequest(@NonNull HttpProxy httpProxy,
7676

7777
// If the origin is HTTPS, wrap the tunnel socket with a new SSLSocket (system CA)
7878
if (HTTPS.equalsIgnoreCase(targetUrl.getProtocol())) {
79-
Logger.v("Wrapping tunnel socket with new SSLSocket for origin server handshake");
8079
try {
8180
// Use the provided SSLSocketFactory, which is configured to trust the origin's CA
8281
finalSocket = sslSocketFactory.createSocket(
@@ -99,7 +98,6 @@ HttpResponse executeRequest(@NonNull HttpProxy httpProxy,
9998
} else {
10099
throw new IOException("Failed to create SSLSocket to origin");
101100
}
102-
Logger.v("SSL handshake with origin server completed");
103101
} catch (Exception sslEx) {
104102
Logger.e("Failed to establish SSL connection to origin: " + sslEx.getMessage());
105103
throw new IOException("Failed to establish SSL connection to origin server", sslEx);
@@ -135,6 +133,7 @@ HttpResponse executeRequest(@NonNull HttpProxy httpProxy,
135133
// Let socket-related IOExceptions pass through unwrapped for consistent error handling
136134
throw e;
137135
} catch (Exception e) {
136+
Logger.e("Failed to execute request through custom tunnel: " + e.getMessage());
138137
throw new IOException("Failed to execute request through custom tunnel", e);
139138
}
140139
}
@@ -168,7 +167,6 @@ HttpStreamResponse executeStreamRequest(@NonNull HttpProxy httpProxy,
168167

169168
// If the origin is HTTPS, wrap the tunnel socket with a new SSLSocket (system CA)
170169
if (HTTPS.equalsIgnoreCase(targetUrl.getProtocol())) {
171-
Logger.v("Wrapping tunnel socket with new SSLSocket for origin server handshake");
172170
try {
173171
// Use the provided SSLSocketFactory, which is configured to trust the origin's CA
174172
finalSocket = sslSocketFactory.createSocket(
@@ -191,7 +189,6 @@ HttpStreamResponse executeStreamRequest(@NonNull HttpProxy httpProxy,
191189
} else {
192190
throw new IOException("Failed to create SSLSocket to origin");
193191
}
194-
Logger.v("SSL handshake with origin server completed");
195192
} catch (Exception sslEx) {
196193
Logger.e("Failed to establish SSL connection to origin: " + sslEx.getMessage());
197194
throw new IOException("Failed to establish SSL connection to origin server", sslEx);

src/main/java/io/split/android/client/network/RawHttpResponseParser.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ HttpResponse parseHttpResponse(@NonNull InputStream inputStream, Certificate[] s
4040
throw new IOException("No HTTP response received from server");
4141
}
4242

43-
Logger.v("Parsing HTTP status line: " + statusLine);
4443
int statusCode = parseStatusCode(statusLine);
4544

4645
// 2. Read and parse response headers directly
@@ -201,7 +200,7 @@ private String readChunkedBodyWithCharset(InputStream inputStream, Charset chars
201200
// Read trailing headers until empty line
202201
String trailerLine;
203202
while ((trailerLine = readLineFromStream(inputStream)) != null && !trailerLine.trim().isEmpty()) {
204-
Logger.v("Chunked trailer: " + trailerLine);
203+
// no-op
205204
}
206205
break;
207206
}

src/main/java/io/split/android/client/network/SslProxyTunnelEstablisher.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
import javax.net.ssl.SSLSocket;
2020
import javax.net.ssl.SSLSocketFactory;
2121

22-
import io.split.android.client.utils.logger.Logger;
23-
2422
/**
2523
* Establishes SSL tunnels to SSL proxies using CONNECT protocol.
2624
*/
@@ -127,8 +125,6 @@ private void sendConnectRequest(@NonNull SSLSocket sslSocket,
127125
int targetPort,
128126
@Nullable ProxyCredentialsProvider proxyCredentialsProvider) throws IOException {
129127

130-
Logger.v("Sending CONNECT request through SSL: CONNECT " + targetHost + ":" + targetPort + " HTTP/1.1");
131-
132128
PrintWriter writer = new PrintWriter(new OutputStreamWriter(sslSocket.getOutputStream(), StandardCharsets.UTF_8), false);
133129
writer.write("CONNECT " + targetHost + ":" + targetPort + " HTTP/1.1" + CRLF);
134130
writer.write("Host: " + targetHost + ":" + targetPort + CRLF);
@@ -140,8 +136,6 @@ private void sendConnectRequest(@NonNull SSLSocket sslSocket,
140136
// Send empty line to end headers
141137
writer.write(CRLF);
142138
writer.flush();
143-
144-
Logger.v("CONNECT request sent through SSL connection");
145139
}
146140

147141
private void addProxyAuthHeader(@NonNull ProxyCredentialsProvider proxyCredentialsProvider, PrintWriter writer) {
@@ -167,8 +161,6 @@ private void addProxyAuthHeader(@NonNull ProxyCredentialsProvider proxyCredentia
167161
*/
168162
private void validateConnectResponse(@NonNull SSLSocket sslSocket) throws IOException {
169163

170-
Logger.v("Reading CONNECT response through SSL connection");
171-
172164
try {
173165
BufferedReader reader = new BufferedReader(new InputStreamReader(sslSocket.getInputStream(), StandardCharsets.UTF_8));
174166

@@ -177,8 +169,6 @@ private void validateConnectResponse(@NonNull SSLSocket sslSocket) throws IOExce
177169
throw new IOException("No CONNECT response received from proxy");
178170
}
179171

180-
Logger.v("Received CONNECT response through SSL: " + statusLine.trim());
181-
182172
// Parse status code
183173
String[] statusParts = statusLine.split(" ");
184174
if (statusParts.length < 2) {
@@ -195,7 +185,7 @@ private void validateConnectResponse(@NonNull SSLSocket sslSocket) throws IOExce
195185
// Read headers until empty line (but don't process them for CONNECT)
196186
String headerLine;
197187
while ((headerLine = reader.readLine()) != null && !headerLine.trim().isEmpty()) {
198-
Logger.v("CONNECT response header: " + headerLine);
188+
// no-op
199189
}
200190

201191
// Check status code

0 commit comments

Comments
 (0)