MXS-1220: Add request body parsing

The HTTP request body is expected to be a valid JSON object. All other
requests are considered malformed requests and result in a HTTP 400 error.

Added the Jansson license to the LICENSE-THIRDPARTY.TXT file. Imported
some of the tests from the Jansson test suite to the HttpParser test.
This commit is contained in:
Markus Mäkelä
2017-04-16 21:31:52 +03:00
committed by Markus Mäkelä
parent 4eb121ce35
commit c937457738
7 changed files with 244 additions and 24 deletions

View File

@ -99,7 +99,9 @@ void AdminClient::process()
enum http_code status = parser.get() ? HTTP_200_OK : HTTP_400_BAD_REQUEST;
atomic_write_int64(&m_last_activity, hkheartbeat);
write_response(m_fd, HTTP_200_OK, parser->get_body());
/** Echo the request body back */
write_response(m_fd, HTTP_200_OK, parser->get_json_str());
}
else
{