Skip to content

Commit

Permalink
Update HttpRequestHandler.java
Browse files Browse the repository at this point in the history
  • Loading branch information
ffay committed Aug 25, 2021
1 parent 5929e1b commit 7787a14
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,13 @@ private void outputContent(ChannelHandlerContext ctx, FullHttpRequest request, i
*/
private void outputPages(ChannelHandlerContext ctx, FullHttpRequest request) throws Exception {
HttpResponseStatus status = HttpResponseStatus.OK;
String url = request.getUri().replace(".", "");
URI uri = new URI(url);
URI uri = new URI(request.getUri());
String uriPath = uri.getPath();
if (uriPath.contains("../")) {
status = HttpResponseStatus.FORBIDDEN;
outputContent(ctx, request, status.code(), status.toString(), "text/html");
return;
}
uriPath = uriPath.equals("/") ? "/index.html" : uriPath;
String path = PAGE_FOLDER + uriPath;
File rfile = new File(path);
Expand Down

0 comments on commit 7787a14

Please sign in to comment.