@@ -617,31 +617,6 @@ void HTTPHandler::processQuery(
617617 {},
618618 handle_exception_in_output_format,
619619 query_finish_callback);
620-
621- // / HTTPChunkedReadBuffer doesn't consume the final \r\n0\r\n\r\n if the caller reads exactly all bytes,
622- // / without checking for eof() (i.e. trying to read past the end) after that.
623- // / If those leftovers are then seen by the next request's HTTPServerRequest::readRequest,
624- // / it would in theory produce the error:
625- // / Invalid HTTP version string: /?query=I,
626- // / because that extra 0 field shifts all fields by one, and uri ends up interpreted as version.
627- // / There are a few options how to prevent that:
628- // / 1. Officially require that IInputFormat must drain the input buffer, make sure all implementations do that.
629- // / 2. Make the HTTP handler drain the request's POST read buffer after the request.
630- // / 3. Make HTTPChunkedReadBuffer eagerly drain the final \r\n0\r\n\r\n before returning the final bytes of data,
631- // but that seems very inconvenient to implement because of how zero-copying is done in HTTPChunkedReadBuffer::nextImpl()
632- // / You can find an option (2) implemented below.
633- if (in_post_maybe_compressed->available ())
634- {
635- String remaining;
636- readStringUntilEOF (remaining, *in_post_maybe_compressed);
637- auto hex_string = hexString (remaining.data (), remaining.size ());
638- #if defined(DEBUG_OR_SANITIZER_BUILD)
639- throw Exception (ErrorCodes::LOGICAL_ERROR,
640- " There is still some data in the buffer: {}" , hex_string);
641- #else
642- LOG_WARNING (log, " There is still some data in the buffer: {}" , hex_string);
643- #endif
644- }
645620}
646621
647622bool HTTPHandler::trySendExceptionToClient (
0 commit comments