1
0
Fork 0
mirror of https://github.com/KingDuckZ/kamokan.git synced 2025-08-03 12:50:02 +00:00

Don't respond if the request method is unexpected.

This includes the jolly responder, which now only works
for GET requests.
This commit is contained in:
King_DuckZ 2017-05-24 19:09:42 +01:00
parent 9fff9d793c
commit 4e32006e08
3 changed files with 13 additions and 10 deletions

View file

@ -163,13 +163,14 @@ int main (int parArgc, char* parArgv[], char* parEnvp[]) {
resp_factory.register_maker("", RequestMethodType::POST, &make_response<QuickSubmitPasteResponse>);
resp_factory.register_maker("paste.cgi", RequestMethodType::POST, &make_response<SubmitPasteResponse>);
resp_factory.register_maker("error.cgi", RequestMethodType::GET, &make_response<ErrorResponse>);
resp_factory.register_jolly_maker(&make_response<PastieResponse>);
resp_factory.register_jolly_maker(&make_response<PastieResponse>, RequestMethodType::GET);
std::unique_ptr<Response> response = resp_factory.make_response(
cgi_env->path_info(),
cgi_env->request_method()
);
response->send();
if (response)
response->send();
}
catch (const std::exception& e) {
statuslog->critical("Uncaught exception in main(): \"{}\"", e.what());