From e856c08645698df9187bcb34e27787996050649c Mon Sep 17 00:00:00 2001 From: Lucas Clemente Date: Sun, 4 Sep 2016 11:38:10 +0200 Subject: [PATCH] write http headers in lower case fixes #317 --- h2quic/response_writer.go | 3 ++- h2quic/response_writer_test.go | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/h2quic/response_writer.go b/h2quic/response_writer.go index f6a5961b..6120ca35 100644 --- a/h2quic/response_writer.go +++ b/h2quic/response_writer.go @@ -4,6 +4,7 @@ import ( "bytes" "net/http" "strconv" + "strings" "sync" "github.com/lucas-clemente/quic-go/protocol" @@ -48,7 +49,7 @@ func (w *responseWriter) WriteHeader(status int) { enc.WriteField(hpack.HeaderField{Name: ":status", Value: strconv.Itoa(status)}) for k, v := range w.header { - enc.WriteField(hpack.HeaderField{Name: k, Value: v[0]}) + enc.WriteField(hpack.HeaderField{Name: strings.ToLower(k), Value: v[0]}) } utils.Infof("Responding with %d", status) diff --git a/h2quic/response_writer_test.go b/h2quic/response_writer_test.go index 837fd19b..3d5d56e6 100644 --- a/h2quic/response_writer_test.go +++ b/h2quic/response_writer_test.go @@ -44,9 +44,7 @@ var _ = Describe("Response Writer", func() { w.Header().Add("content-length", "42") w.WriteHeader(http.StatusTeapot) Expect(headerStream.Bytes()).To(Equal([]byte{ - 0x0, 0x0, 0x14, 0x1, 0x4, 0x0, 0x0, 0x0, 0x5, 0x48, 0x3, 0x34, 0x31, 0x38, - 0x40, 0x8a, 0xbc, 0x7a, 0x92, 0x5a, 0x92, 0xb6, 0x72, 0xd5, 0x32, 0x67, - 0x2, 0x34, 0x32, + 0x0, 0x0, 0x9, 0x1, 0x4, 0x0, 0x0, 0x0, 0x5, 0x48, 0x3, 0x34, 0x31, 0x38, 0x5c, 0x2, 0x34, 0x32, })) })