Add a getstringifcomplete function to hpackdecoderstringbuffer to return string only when state is complete. used in error details, not protected.
PiperOrigin-RevId: 323777904
Change-Id: I9beb5ace10f4ceb0aeed76bb8c37015ce808a8f6
diff --git a/http2/hpack/decoder/hpack_decoder_string_buffer.h b/http2/hpack/decoder/hpack_decoder_string_buffer.h
index 1ae8e6b..1341e79 100644
--- a/http2/hpack/decoder/hpack_decoder_string_buffer.h
+++ b/http2/hpack/decoder/hpack_decoder_string_buffer.h
@@ -53,6 +53,9 @@
// transport buffers).
quiche::QuicheStringPiece str() const;
+ // Same as str() if state_ is COMPLETE. Otherwise, returns empty string piece.
+ quiche::QuicheStringPiece GetStringIfComplete() const;
+
// Returns the completely collected string by value, using std::move in an
// effort to avoid unnecessary copies. ReleaseString() must not be called
// unless the string has been buffered (to avoid forcing a potentially