Expands Http2VisitorInterface::OnHeaderForStream() to return an enum representing either OK, invalid or RST_STREAM.

This turns out to be necessary for tests related to invalid headers to pass.

This change fills in the implementation gap in the OG stack, with one minor difference: since the application is indicating the header error and potentially queuing the RST_STREAM, CloseStream() does not re-deliver the same error code back to the application.

PiperOrigin-RevId: 381958205
diff --git a/http2/adapter/http2_visitor_interface.h b/http2/adapter/http2_visitor_interface.h
index f71e21c..e3f7c53 100644
--- a/http2/adapter/http2_visitor_interface.h
+++ b/http2/adapter/http2_visitor_interface.h
@@ -83,11 +83,21 @@
   // Called when the connection receives the header |key| and |value| for a
   // stream. The HTTP/2 pseudo-headers defined in RFC 7540 Sections 8.1.2.3 and
   // 8.1.2.4 are also conveyed in this callback. This method is called after
-  // OnBeginHeadersForStream(). Should return "false" to indicate that the
-  // header name or value should be rejected. This will cause the HTTP
-  // transaction to fail.
-  virtual bool OnHeaderForStream(Http2StreamId stream_id, absl::string_view key,
-                                 absl::string_view value) = 0;
+  // OnBeginHeadersForStream(). May return HEADER_RST_STREAM to indicate the
+  // header block should be rejected. This will cause the library to queue a
+  // RST_STREAM frame, which will have a default error code of INTERNAL_ERROR.
+  // The visitor implementation may choose to queue a RST_STREAM with a
+  // different error code instead, which should be done before returning
+  // HEADER_RST_STREAM. Returning HEADER_CONNECTION_ERROR will lead to a
+  // non-recoverable error on the connection.
+  enum OnHeaderResult {
+    HEADER_OK,
+    HEADER_CONNECTION_ERROR,
+    HEADER_RST_STREAM,
+  };
+  virtual OnHeaderResult OnHeaderForStream(Http2StreamId stream_id,
+                                           absl::string_view key,
+                                           absl::string_view value) = 0;
 
   // Called when the connection has received the complete header block for a
   // logical HEADERS frame on a stream (which may contain CONTINUATION frames,