2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

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.
This commit is contained in:
Artem Boldariev
2021-07-05 16:48:54 +03:00
parent 1792740075
commit fedff2cd6c

View File

@@ -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);
}