http3: reject connection-specific header fields, check value of TE (#4655)

This commit is contained in:
Marten Seemann
2024-09-01 17:20:35 +08:00
committed by GitHub
parent 1a25053e5e
commit 26a3525337
3 changed files with 44 additions and 10 deletions

View File

@@ -765,8 +765,7 @@ var _ = Describe("HTTP tests", func() {
It("processes 1xx terminal response", func() {
mux.HandleFunc("/101-switch-protocols", func(w http.ResponseWriter, r *http.Request) {
defer GinkgoRecover()
w.Header().Add("Connection", "upgrade")
w.Header().Add("Upgrade", "proto")
w.Header().Add("foo", "bar")
w.WriteHeader(http.StatusSwitchingProtocols)
})
@@ -787,8 +786,7 @@ var _ = Describe("HTTP tests", func() {
resp, err := client.Do(req)
Expect(err).ToNot(HaveOccurred())
Expect(resp.StatusCode).To(Equal(http.StatusSwitchingProtocols))
Expect(resp.Header).To(HaveKeyWithValue("Connection", []string{"upgrade"}))
Expect(resp.Header).To(HaveKeyWithValue("Upgrade", []string{"proto"}))
Expect(resp.Header).To(HaveKeyWithValue("Foo", []string{"bar"}))
Expect(status).To(Equal(0))
Expect(cnt).To(Equal(0))
})