Skip to content

Commit

Permalink
doveadm-http: Return HTTP failure on unexpected JSON input
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen committed Feb 22, 2016
1 parent 9cd71e2 commit 346ce9e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/doveadm/client-connection-http.c
Expand Up @@ -462,7 +462,7 @@ doveadm_http_server_read_request(struct client_connection_http *conn)
if (!conn->client.input->eof && rc == 0)
return;

if ((rc == 1 && conn->json_state != JSON_STATE_DONE)) {
if (rc == -2 || (rc == 1 && conn->json_state != JSON_STATE_DONE)) {
/* this will happen if the parser above runs into unexpected element, but JSON is OK */
http_server_request_fail_close(conn->http_server_request, 400, "Unexpected element in input");
// FIXME: should be returned as error to client, not logged
Expand Down

0 comments on commit 346ce9e

Please sign in to comment.