FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Process all method like POST (with body). by IgorGalarraga · Pull Request #165 · etr/libhttpserver · GitHub

Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .cpp  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
8 changes: 1 addition & 7 deletions src/webserver.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -776,8 +776,6 @@ int webserver::answer_to_connection(void* cls, MHD_Connection* connection,
base_unescaper(t_url, static_cast<webserver*>(cls)->unescaper);
mr->standardized_url = new string(http_utils::standardize_url(t_url));

bool body = false;

access_log(
static_cast<webserver*>(cls),
*(mr->complete_uri) + " METHOD: " + method
Expand All @@ -790,22 +788,18 @@ int webserver::answer_to_connection(void* cls, MHD_Connection* connection,
else if (0 == strcmp(method, http_utils::http_method_post.c_str()))
{
mr->callback = &http_resource::render_POST;
body = true;
}
else if (0 == strcasecmp(method, http_utils::http_method_put.c_str()))
{
mr->callback = &http_resource::render_PUT;
body = true;
}
else if (0 == strcasecmp(method,http_utils::http_method_delete.c_str()))
{
mr->callback = &http_resource::render_DELETE;
body = true;
}
else if (0 == strcasecmp(method, http_utils::http_method_patch.c_str()))
{
mr->callback = &http_resource::render_PATCH;
body = true;
}
else if (0 == strcasecmp(method, http_utils::http_method_head.c_str()))
{
Expand All @@ -824,7 +818,7 @@ int webserver::answer_to_connection(void* cls, MHD_Connection* connection,
mr->callback = &http_resource::render_OPTIONS;
}

return body ? static_cast<webserver*>(cls)->bodyfull_requests_answer_first_step(connection, mr) : static_cast<webserver*>(cls)->bodyless_requests_answer(connection, method, version, mr);
return static_cast<webserver*>(cls)->bodyfull_requests_answer_first_step(connection, mr);
}

};

Back | FazBrowse Home | New Git URL