Introduce granular QPACK encoder/decoder stream error codes.
Add new error codes to QpackInstructionDecoder. This class is used by
QpackEncoderStreamReceived to decode the encoder stream, by
QpackDecoderStreamReceived to decode the decoder stream, and by
QpackProgressiveDecoder to decode header blocks. Ignore error codes in
QpackProgressiveDecoder because header block decoding errors are stream errors,
not connection close errors, and unlike CONNECTION_CLOSE frames, RESET_STREAM
frames are not able to convey any extra information other than the mandatory
generic error code. Convert QpackInstructionDecoder::ErrorCode error codes to
newly added QuicErrorCodes in
QpackEncoderStreamReceiver::OnInstructionDecodingError() and
QpackDecoderStreamReceiver::OnInstructionDecodingError().
QPACK encoder stream errors are detected in QpackEncoderStreamReceiver and in
QpackDecoder. Swap all QuicErrorCodes to the new ones, and gate them by the
flag in a single place, in QpackDecoder::OnErrorDetected(). Do the same thing
for QPACK decoder stream errors in QpackDecoderStreamReceiver and QpackEncoder.
Protected by FLAGS_quic_reloadable_flag_quic_granular_qpack_error_codes.
PiperOrigin-RevId: 338170616
Change-Id: I40fbf1c04869d74984e20f48c317daa995b6e99d
diff --git a/quic/core/qpack/qpack_instruction_decoder.h b/quic/core/qpack/qpack_instruction_decoder.h
index 759c8f0..b8edfb7 100644
--- a/quic/core/qpack/qpack_instruction_decoder.h
+++ b/quic/core/qpack/qpack_instruction_decoder.h
@@ -22,6 +22,12 @@
// fields that follow each instruction.
class QUIC_EXPORT_PRIVATE QpackInstructionDecoder {
public:
+ enum class ErrorCode {
+ INTEGER_TOO_LARGE,
+ STRING_LITERAL_TOO_LONG,
+ HUFFMAN_ENCODING_ERROR,
+ };
+
// Delegate is notified each time an instruction is decoded or when an error
// occurs.
class QUIC_EXPORT_PRIVATE Delegate {
@@ -43,6 +49,7 @@
// Implementations are allowed to destroy the QpackInstructionDecoder
// instance synchronously.
virtual void OnInstructionDecodingError(
+ ErrorCode error_code,
absl::string_view error_message) = 0;
};
@@ -110,7 +117,7 @@
const QpackInstruction* LookupOpcode(uint8_t byte) const;
// Stops decoding and calls Delegate::OnInstructionDecodingError().
- void OnError(absl::string_view error_message);
+ void OnError(ErrorCode error_code, absl::string_view error_message);
// Describes the language used for decoding.
const QpackLanguage* const language_;