]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Return "Bad Request" (400) in a case of Base64 decoding error
authorArtem Boldariev <artem@boldariev.com>
Mon, 5 Jul 2021 13:48:54 +0000 (16:48 +0300)
committerArtem Boldariev <artem@boldariev.com>
Fri, 9 Jul 2021 13:26:46 +0000 (16:26 +0300)
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.

lib/isc/netmgr/http.c

index 723dd57e7e8e3b7615bf08100dc68b4a007df54b..a21c882e86c1539eab9ca2bececd97d49ac73860 100644 (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);
 }