Support checking banned IPs from external server proxied requests

This commit is contained in:
Mike Primm 2011-12-03 05:31:37 +08:00 committed by mikeprimm
parent 82318346c2
commit 8f6982265a
3 changed files with 35 additions and 28 deletions

View file

@ -147,6 +147,14 @@ public class HttpServerConnection extends Thread {
if (!readRequestHeader(in, request)) {
return;
}
String fwd_for = request.fields.get("X-Forwarded-For");
if(fwd_for != null) {
String[] ff = fwd_for.split(",");
for(int i = 0; i < ff.length; i++) {
if(server.checkForBannedIp(ff[i]))
return;
}
}
long bound = -1;
BoundInputStream boundBody = null;