Updates SpdyHeaderBlock's hashing and equality types to make the data structure case-insensitive with respect to keys.

gfe-relnote: Makes SpdyHeaderBlock case-insensitive with respect to keys. Not possible to protect.
PiperOrigin-RevId: 288035700
Change-Id: Ifdff6aed6e65f96c60e3ef9d164f7899a0a23baa
diff --git a/spdy/core/hpack/hpack_decoder_adapter_test.cc b/spdy/core/hpack/hpack_decoder_adapter_test.cc
index f1bfe0c..ab3ac77 100644
--- a/spdy/core/hpack/hpack_decoder_adapter_test.cc
+++ b/spdy/core/hpack/hpack_decoder_adapter_test.cc
@@ -410,7 +410,7 @@
                                            std::string("foo\0baz", 7));
 
   // Other headers are joined on \0. Case matters.
-  decoder_peer_.HandleHeaderRepresentation("joined", "not joined");
+  decoder_peer_.HandleHeaderRepresentation("joined", "joined");
   decoder_peer_.HandleHeaderRepresentation("joineD", "value 1");
   decoder_peer_.HandleHeaderRepresentation("joineD", "value 2");
 
@@ -435,8 +435,8 @@
       ElementsAre(
           Pair("cookie", " part 1; part 2 ; part3;  fin!"),
           Pair("passed-through", quiche::QuicheStringPiece("foo\0baz", 7)),
-          Pair("joined", "not joined"),
-          Pair("joineD", quiche::QuicheStringPiece("value 1\0value 2", 15)),
+          Pair("joined",
+               quiche::QuicheStringPiece("joined\0value 1\0value 2", 22)),
           Pair("empty", ""),
           Pair("empty-joined", quiche::QuicheStringPiece("\0foo\0\0", 6))));
 }
diff --git a/spdy/core/spdy_header_block.h b/spdy/core/spdy_header_block.h
index e164478..a625393 100644
--- a/spdy/core/spdy_header_block.h
+++ b/spdy/core/spdy_header_block.h
@@ -18,6 +18,7 @@
 #include "net/third_party/quiche/src/spdy/platform/api/spdy_containers.h"
 #include "net/third_party/quiche/src/spdy/platform/api/spdy_export.h"
 #include "net/third_party/quiche/src/spdy/platform/api/spdy_macros.h"
+#include "net/third_party/quiche/src/spdy/platform/api/spdy_string_utils.h"
 
 namespace spdy {
 
@@ -86,8 +87,8 @@
 
   typedef SpdyLinkedHashMap<quiche::QuicheStringPiece,
                             HeaderValue,
-                            quiche::QuicheStringPieceHash,
-                            std::equal_to<quiche::QuicheStringPiece>>
+                            SpdyStringPieceCaseHash,
+                            SpdyStringPieceCaseEq>
       MapType;
 
  public:
diff --git a/spdy/core/spdy_header_block_test.cc b/spdy/core/spdy_header_block_test.cc
index aad264c..806e89e 100644
--- a/spdy/core/spdy_header_block_test.cc
+++ b/spdy/core/spdy_header_block_test.cc
@@ -220,13 +220,14 @@
   SpdyHeaderBlock block;
   block["Foo"] = "foo";
   block.AppendValueOrAddHeader("Foo", "bar");
-  EXPECT_EQ(block.end(), block.find("foo"));
+  EXPECT_NE(block.end(), block.find("foo"));
   EXPECT_EQ(Pair("Foo", std::string("foo\0bar", 7)), *block.find("Foo"));
 
-  // The map is case sensitive, so both "Foo" and "foo" can be present.
+  // The map is case insensitive, so updating "foo" modifies the entry
+  // previously added.
   block.AppendValueOrAddHeader("foo", "baz");
-  EXPECT_THAT(block, ElementsAre(Pair("Foo", std::string("foo\0bar", 7)),
-                                 Pair("foo", "baz")));
+  EXPECT_THAT(block,
+              ElementsAre(Pair("Foo", std::string("foo\0bar\0baz", 11))));
 }
 
 namespace {