parse the input body for the PUT and PATCH methods too

This commit is contained in:
Tomasz Sowa 2023-09-15 10:04:25 +02:00
parent edee581ecf
commit 79e971cb76
Signed by: tomasz.sowa
GPG Key ID: 662CC1438638588B
1 changed files with 6 additions and 5 deletions

View File

@ -1389,23 +1389,24 @@ void App::ReadPostJson()
void App::ReadPostVars()
{
if( cur.request->method == Request::post || cur.request->method == Request::delete_ )
if( cur.request->method == Request::post || cur.request->method == Request::put ||
cur.request->method == Request::patch || cur.request->method == Request::delete_ )
{
if( pt::is_substr_nc(Header::multipart_form_data, cur.request->env_content_type.c_str()) )
{
log << log3 << "App: post content type: " << Header::multipart_form_data << logend;
log << log3 << "App: content type: " << Header::multipart_form_data << logend;
post_multi_parser.Parse(cur.request->fcgi_request.in, *cur.request); // IMPROVEME add checking for return status
}
else
if( pt::is_substr_nc(Winix::Header::application_json, cur.request->env_content_type.c_str()) )
{
log << log3 << "App: post content type: " << Winix::Header::application_json << ", using json parser" << logend;
log << log3 << "App: content type: " << Winix::Header::application_json << ", using json parser" << logend;
ReadPostJson();
}
else
if( pt::is_substr_nc(Header::application_x_www_form_urlencoded, cur.request->env_content_type.c_str()) )
{
log << log3 << "App: post content type: " << Winix::Header::application_x_www_form_urlencoded << logend;
log << log3 << "App: content type: " << Winix::Header::application_x_www_form_urlencoded << logend;
post_parser.Parse(cur.request->fcgi_request.in, *cur.request); // IMPROVEME add checking for return status
}
else
@ -1422,7 +1423,7 @@ void App::ReadPostVars()
if( config.log_whole_http_post )
{
cur.request->post_in.serialize_to_json_stream(post_log_tmp_buffer, true);
log << log3 << "App: the whole http post after parsing:" << logend << post_log_tmp_buffer << logend;
log << log3 << "App: the whole http body after parsing:" << logend << post_log_tmp_buffer << logend;
post_log_tmp_buffer.clear();
}
}