Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Banned IP entry into an error log #332

Open
RobertFojtikAEN opened this issue Oct 12, 2023 · 0 comments
Open

Banned IP entry into an error log #332

RobertFojtikAEN opened this issue Oct 12, 2023 · 0 comments
Assignees
Labels
feature-request Feature requests or enhancements

Comments

@RobertFojtikAEN
Copy link

Is there any issue to write banned IP entry to an error log ?

Something like that:

if ((((static_cast<webserver*>(cls))->default_policy == http_utils::ACCEPT) &&
            ((static_cast<webserver*>(cls))->bans.count(ip_representation(addr))) &&
            (!(static_cast<webserver*>(cls))->allowances.count(ip_representation(addr)))) ||
        (((static_cast<webserver*>(cls))->default_policy == http_utils::REJECT) &&
         ((!(static_cast<webserver*>(cls))->allowances.count(ip_representation(addr))) ||
          ((static_cast<webserver*>(cls))->bans.count(ip_representation(addr)))))) {
    
    //log banned IP
    std::string msg = "IP '" + httpserver::http::get_ip_str(addr) + "' rejected\n";
    webserver* dws = static_cast<webserver*>(cls);
    dws->log_error(msg);

    return MHD_NO;
}
@RobertFojtikAEN RobertFojtikAEN added the feature-request Feature requests or enhancements label Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Feature requests or enhancements
Projects
None yet
Development

No branches or pull requests

2 participants