http3: reset stream when a handler panics (#4181)

* interrupt the stream when a panick happened

* move the declaration of errPanicked

* check what's read is a prefix of what's written

* check errPanicked

* use MatchError instead of Equal

* use channel to notify the response has been received
This commit is contained in:
WeidiDeng
2023-12-16 11:39:49 +08:00
committed by GitHub
parent 06c6a8449b
commit e0bf13be01
3 changed files with 28 additions and 2 deletions

View File

@@ -272,7 +272,7 @@ var _ = Describe("Server", func() {
str.EXPECT().CancelRead(gomock.Any())
serr := s.handleRequest(conn, str, qpackDecoder, nil)
Expect(serr.err).ToNot(HaveOccurred())
Expect(serr.err).To(MatchError(errPanicked))
Expect(responseBuf.Bytes()).To(HaveLen(0))
})
@@ -288,7 +288,7 @@ var _ = Describe("Server", func() {
str.EXPECT().CancelRead(gomock.Any())
serr := s.handleRequest(conn, str, qpackDecoder, nil)
Expect(serr.err).ToNot(HaveOccurred())
Expect(serr.err).To(MatchError(errPanicked))
Expect(responseBuf.Bytes()).To(HaveLen(0))
})