diff options
Diffstat (limited to 'httpresource.c')
-rwxr-xr-x | httpresource.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/httpresource.c b/httpresource.c index 375460f..367a897 100755 --- a/httpresource.c +++ b/httpresource.c @@ -284,6 +284,11 @@ int cHttpResource::processRequest() { struct stat statbuf; bool ok_to_serve = false; + if (mFactory->isBlackListed (mRemoteAddr)) { + mResponse = new cResponseError(this, 400, "Bad Request", NULL, "00x Blacklisted."); + return OKAY; + } + if (mMethod.compare("POST")==0) { return handlePost(); } @@ -392,6 +397,12 @@ int cHttpResource::processRequest() { return OKAY; } + if (mPath.compare("/getBlacklist") == 0) { + mResponse = new cResponseMemBlk(this); + ((cResponseMemBlk*)mResponse)->get_blacklist(); + return OKAY; + } + #endif if (mPath.compare("/deleteFile") == 0) { @@ -733,6 +744,17 @@ int cHttpResource::handlePost() { return OKAY; } + if (mPath.compare("/addToBlacklist") == 0) { + mResponse = new cResponseMemBlk(this); + ((cResponseMemBlk*)mResponse)->post_addToBlacklist(); + return OKAY; + } + if (mPath.compare("/removeFromBlacklist") == 0) { + mResponse = new cResponseMemBlk(this); + ((cResponseMemBlk*)mResponse)->post_removeFromBlacklist(); + return OKAY; + } + // Should not reach the end of the function return ERROR; |