From: Artem Boldariev Date: Mon, 5 Jul 2021 13:48:54 +0000 (+0300) Subject: Return "Bad Request" (400) in a case of Base64 decoding error X-Git-Tag: v9.17.17~41^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fedff2cd6c3b83a5f59e331201a4b0673174d0f7;p=thirdparty%2Fbind9.git Return "Bad Request" (400) in a case of Base64 decoding error This error code fits better than the more generic "Internal Server Error" (500) which implies that the problem is on the server. Also, do not end the whole HTTP/2 session on a bad request. --- diff --git a/lib/isc/netmgr/http.c b/lib/isc/netmgr/http.c index 723dd57e7e8..a21c882e86c 100644 --- a/lib/isc/netmgr/http.c +++ b/lib/isc/netmgr/http.c @@ -2036,7 +2036,7 @@ server_on_request_recv(nghttp2_session *ngsession, if (isc_base64_decodestring(socket->h2.query_data, &decoded_buf) != ISC_R_SUCCESS) { - code = ISC_HTTP_ERROR_GENERIC; + code = ISC_HTTP_ERROR_BAD_REQUEST; goto error; } isc__buffer_usedregion(&decoded_buf, &data); @@ -2055,7 +2055,7 @@ server_on_request_recv(nghttp2_session *ngsession, error: result = server_send_error_response(code, ngsession, socket); if (result != ISC_R_SUCCESS) { - return (NGHTTP2_ERR_CALLBACK_FAILURE); + return (NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE); } return (0); }