Don't print full URI to log
The port printed is the local listen port, not the port used by client.
@@ -240,7 +240,7 @@ public abstract class LoggingRequestHandler extends ThreadedHttpRequestHandler {
renderStartTime,
commitStartTime,
endTime,
- jdiscRequest.getUri().toString(),
+ getUri(jdiscRequest),
extendedResponse.getParsedQuery(),
extendedResponse.getTiming());
@@ -272,6 +272,16 @@ public abstract class LoggingRequestHandler extends ThreadedHttpRequestHandler {
accessLog.log(accessLogEntry);
}
+
+ private String getUri(com.yahoo.jdisc.http.HttpRequest jdiscRequest) {
+ URI uri = jdiscRequest.getUri();
+ StringBuilder builder = new StringBuilder(uri.getPath());
+ String query = uri.getQuery();
+ if (query != null && !query.isBlank()) {
+ builder.append('?').append(query);
+ }
+ return builder.toString();
+ }
}
private void populateAccessLogEntryNotCreatedByHttpServer(AccessLogEntry logEntry,
