No public description PiperOrigin-RevId: 933735310
diff --git a/quiche/balsa/balsa_frame.cc b/quiche/balsa/balsa_frame.cc index 6eb467e..35f8ac9 100644 --- a/quiche/balsa/balsa_frame.cc +++ b/quiche/balsa/balsa_frame.cc
@@ -94,6 +94,8 @@ trailers_->Clear(); } is_valid_target_uri_ = true; + in_quote_ = false; + is_escaped_ = false; } namespace { @@ -1267,6 +1269,8 @@ --current; parse_state_ = BalsaFrameEnums::READING_CHUNK_EXTENSION; + in_quote_ = false; + is_escaped_ = false; last_char_was_slash_r_ = false; visitor_->OnChunkLength(chunk_length_remaining_); continue; @@ -1286,6 +1290,19 @@ return current - input; } const char c = *current; + + if (is_escaped_) { + // Previous char was a backslash and it's parsing quoted section. + is_escaped_ = false; + } else { + // Not escaped, so check for backslash and quotes. + if (c == '\\' && in_quote_) { + is_escaped_ = true; + } else if (c == '"') { + in_quote_ = !in_quote_; + } + } + if (c == ';') { found_semicolon = true; }
diff --git a/quiche/balsa/balsa_frame.h b/quiche/balsa/balsa_frame.h index c0338c5..d71411c 100644 --- a/quiche/balsa/balsa_frame.h +++ b/quiche/balsa/balsa_frame.h
@@ -30,7 +30,7 @@ // BalsaFrame is a lightweight HTTP framer. class QUICHE_EXPORT BalsaFrame : public FramerInterface { public: - typedef std::vector<std::pair<size_t, size_t> > Lines; + typedef std::vector<std::pair<size_t, size_t>> Lines; typedef BalsaHeaders::HeaderLineDescription HeaderLineDescription; typedef BalsaHeaders::HeaderLines HeaderLines; @@ -65,7 +65,9 @@ request_was_head_(false), is_valid_target_uri_(true), use_interim_headers_callback_(false), - parse_truncated_headers_even_when_headers_too_long_(false) {} + parse_truncated_headers_even_when_headers_too_long_(false), + in_quote_(false), + is_escaped_(false) {} ~BalsaFrame() override {} @@ -316,6 +318,10 @@ // This is not reset in Reset(). bool parse_truncated_headers_even_when_headers_too_long_ : 1; + + // Specific to parsing of chunk extensions. + bool in_quote_ : 1; + bool is_escaped_ : 1; }; } // namespace quiche