From 79e971cb765b08b41c8be5e11bb31a648ae8385a Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Fri, 15 Sep 2023 10:04:25 +0200 Subject: [PATCH] parse the input body for the PUT and PATCH methods too --- winixd/core/app.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/winixd/core/app.cpp b/winixd/core/app.cpp index cc48b7c..0f53069 100644 --- a/winixd/core/app.cpp +++ b/winixd/core/app.cpp @@ -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(); } }