Skip to content

Commit

Permalink
FISH-6775 Fix detail message
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Pielage <pandrex247@hotmail.com>
  • Loading branch information
Pandrex247 committed Dec 2, 2022
1 parent 76864a3 commit da6122b
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ protected boolean postParseRequest(

// Normalize Decoded URI
if (!normalize(decodedURI, catalinaResponse)) {
catalinaResponse.sendError(HttpServletResponse.SC_BAD_REQUEST, "Invalid URI");
catalinaResponse.sendError(SC_BAD_REQUEST, catalinaResponse.getDetailMessage());
return false;
}

Expand Down Expand Up @@ -517,7 +517,7 @@ private static boolean normalizeBytes(DataChunk uriDataChunk, Response response)

// An empty URL is not acceptable
if (start == end) {
response.setDetailMessage("Empty URL");
response.setDetailMessage("Invalid URI: Empty URL");
return false;
}

Expand All @@ -536,19 +536,19 @@ private static boolean normalizeBytes(DataChunk uriDataChunk, Response response)
if (ALLOW_BACKSLASH) {
b[pos] = (byte) '/';
} else {
response.setDetailMessage("Backslashes not allowed");
response.setDetailMessage("Invalid URI: Backslashes not allowed");
return false;
}
}
if (b[pos] == (byte) 0) {
response.setDetailMessage("Null byte found during request normalization");
response.setDetailMessage("Invalid URI: Null byte found during request normalization");
return false;
}
}

// The URL must start with '/'
if (b[start] != (byte) '/') {
response.setDetailMessage("Request must start with /");
response.setDetailMessage("Invalid URI: Request must start with /");
return false;
}

Expand Down Expand Up @@ -599,7 +599,7 @@ private static boolean normalizeBytes(DataChunk uriDataChunk, Response response)
}
// Prevent from going outside our context
if (index == 0) {
response.setDetailMessage("Request traversed outside of allowed context");
response.setDetailMessage("Invalid URI: Request traversed outside of allowed context");
return false;
}
int index2 = -1;
Expand Down Expand Up @@ -639,19 +639,19 @@ private static boolean normalizeChars(DataChunk uriDataChunk, Response response)
if (ALLOW_BACKSLASH) {
c[pos] = '/';
} else {
response.setDetailMessage("Backslashes not allowed");
response.setDetailMessage("Invalid URI: Backslashes not allowed");
return false;
}
}
if (c[pos] == (char) 0) {
response.setDetailMessage("Null byte found during request normalization");
response.setDetailMessage("Invalid URI: Null byte found during request normalization");
return false;
}
}

// The URL must start with '/'
if (c[start] != '/') {
response.setDetailMessage("Request must start with /");
response.setDetailMessage("Invalid URI: Request must start with /");
return false;
}

Expand Down Expand Up @@ -702,7 +702,7 @@ private static boolean normalizeChars(DataChunk uriDataChunk, Response response)
}
// Prevent from going outside our context
if (index == 0) {
response.setDetailMessage("Request traversed outside of allowed context");
response.setDetailMessage("Invalid URI: Request traversed outside of allowed context");
return false;
}
int index2 = -1;
Expand Down

0 comments on commit da6122b

Please sign in to comment.