Add the new `size()` method to ConstHeaderApi and its implementations. This change introduces a virtual `size()` method to the `ConstHeaderApi`. Implementations in `BalsaHeaders`, `WrappedConstEnvoyHeaders`, and `HeaderApiWrapper` are updated to support this. We will then use this to call this method from the DoS eval, which uses `ConstHeaderApi`. PiperOrigin-RevId: 936415990
diff --git a/quiche/balsa/balsa_headers.h b/quiche/balsa/balsa_headers.h index d7e90cf..da57922 100644 --- a/quiche/balsa/balsa_headers.h +++ b/quiche/balsa/balsa_headers.h
@@ -1015,7 +1015,7 @@ bool IsEmpty() const override; - size_t size() const { + size_t size() const override { if (header_lines_removed_ > header_lines_.size()) { return 0; }
diff --git a/quiche/balsa/header_api.h b/quiche/balsa/header_api.h index e607172..f9f0a17 100644 --- a/quiche/balsa/header_api.h +++ b/quiche/balsa/header_api.h
@@ -44,6 +44,9 @@ // Determine whether the headers are empty. virtual bool IsEmpty() const = 0; + // Returns the number of headers. + virtual size_t size() const = 0; + // Returns the header entry for the first instance with key |key| // If header isn't present, returns absl::string_view(). virtual absl::string_view GetHeader(absl::string_view key) const = 0;