diff --git a/winixd/core/app.cpp b/winixd/core/app.cpp index e07e695..d4d4cdd 100644 --- a/winixd/core/app.cpp +++ b/winixd/core/app.cpp @@ -1095,14 +1095,21 @@ void App::ReadPostJson() } while( read_len == buffer_len ); - PT::JSONToSpaceParser::Status status = post_json_parser.ParseString(post_buffer.c_str()); - post_buffer.clear(); + if( !post_buffer.empty() ) + { + PT::JSONToSpaceParser::Status status = post_json_parser.ParseString(post_buffer.c_str()); + post_buffer.clear(); - if( status != PT::JSONToSpaceParser::ok ) + if( status != PT::JSONToSpaceParser::ok ) + { + log << log1 << "App: cannot parse the input stream as a JSON object, status: " << (int)status << logend; + cur.request->post_in.Clear(); + // return an error (http error of some kind?) + } + } + else { - log << log1 << "App: cannot parse the input stream as a JSON object, status: " << (int)status << logend; - cur.request->post_in.Clear(); - // return an error (http error of some kind?) + log << log3 << "App: input body empty (skipping parsing)" << logend; } }