diff --git a/build.gradle b/build.gradle index c5621a0..2708ae7 100644 --- a/build.gradle +++ b/build.gradle @@ -23,10 +23,7 @@ sourceSets { } dependencies { api project (":common") - api 'io.netty:netty-all:4.1.52.Final' api 'io.netty:netty-tcnative-boringssl-static:2.0.41.Final' - api 'org.apache.logging.log4j:log4j-core:2.15.0' - api 'org.apache.logging.log4j:log4j-api:2.15.0' api 'com.google.code.gson:gson:2.8.8' testImplementation 'junit:junit:4.13.2' diff --git a/src/main/src/org/bdware/server/action/HttpResultCallback.java b/src/main/src/org/bdware/server/action/HttpResultCallback.java index 892ce51..2f98e18 100644 --- a/src/main/src/org/bdware/server/action/HttpResultCallback.java +++ b/src/main/src/org/bdware/server/action/HttpResultCallback.java @@ -67,7 +67,6 @@ public class HttpResultCallback extends ResultCallback implements Runnable { HttpUtil.setContentLength(response, bytes.length); ChannelFuture future = ctxField.writeAndFlush(response); future.addListener(ChannelFutureListener.CLOSE); - } public void setDecodeBase64() { diff --git a/src/main/src/org/bdware/server/http/HttpFileHandleAdapter.java b/src/main/src/org/bdware/server/http/HttpFileHandleAdapter.java index 2bb6236..eedf0d9 100644 --- a/src/main/src/org/bdware/server/http/HttpFileHandleAdapter.java +++ b/src/main/src/org/bdware/server/http/HttpFileHandleAdapter.java @@ -11,18 +11,13 @@ import io.netty.handler.stream.ChunkedFile; import java.io.File; import java.io.FileFilter; import java.io.RandomAccessFile; -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.util.regex.Pattern; import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1; public class HttpFileHandleAdapter extends SimpleChannelInboundHandler { - private static final Pattern ALLOWED_FILE_NAME = - Pattern.compile("[A-Za-z0-9][-_A-Za-z0-9\\.]*"); - private static final Pattern INSECURE_URI = Pattern.compile(".*[<>&\"].*"); + FileFilter fileFilter; - private String location; + private final String location; public HttpFileHandleAdapter(String path, FileFilter fileFilter) { location = path; @@ -35,7 +30,7 @@ public class HttpFileHandleAdapter extends SimpleChannelInboundHandler