zeroflag commented on code in PR #650:
URL: https://github.com/apache/knox/pull/650#discussion_r1002972633
##########
gateway-spi/src/main/java/org/apache/knox/gateway/dispatch/GatewayDispatchFilter.java:
##########
@@ -145,14 +147,21 @@ private boolean isDispatchAllowed(HttpServletRequest
request) {
if (whitelist != null) {
String requestURI = request.getRequestURI();
- String decodedURL = null;
+ String decodedURL = requestURI;
try {
decodedURL = URLDecoder.decode(requestURI,
StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
//
}
+ String baseUrl;
+ try {
+ URL url = new URL(decodedURL);
+ baseUrl = new URL(url.getProtocol(), url.getHost(), url.getPort(),
"").toString();
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e);
Review Comment:
Hi @moresandeep, if we log it here then the message will appear in the log
two times. I tested this with a malformed URL and the exception was still
visible in the gateway.log, because at the outer level we catch and log
everything. I don't see a reason to log it here too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]