Skip to content

Commit 1dfbb6a

Browse files
author
FungY911
committed
Host Filter - Allow only host what is in domain
1 parent bb07181 commit 1dfbb6a

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/main/java/tk/fungy/wsformc/WebServer.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ public void start() {
108108
@Override
109109
public Response serve(IHTTPSession session) {
110110
String uri = session.getUri().toLowerCase();
111+
String hostHeader = session.getHeaders().get("host");
112+
if (hostHeader == null || !hostHeader.contains(domain + ":" + port)) {
113+
return newFixedLengthResponse(Response.Status.BAD_REQUEST, "text/plain", "DNS_PROBE_POSSIBLE");
114+
}
115+
111116

112117
if (uri.endsWith("/")) {
113118
uri = "/index.html";

0 commit comments

Comments
 (0)