reject push streams initiated by the client

This commit is contained in:
Marten Seemann
2020-12-21 15:31:36 +07:00
parent bf54ffe0df
commit 04eebb7f6a
2 changed files with 31 additions and 1 deletions

View File

@@ -40,6 +40,7 @@ const (
nextProtoH3Draft29 = "h3-29"
nextProtoH3Draft32 = "h3-32"
streamTypeControlStream = 0
streamTypePushStream = 1
)
func versionToALPN(v protocol.VersionNumber) string {
@@ -272,7 +273,13 @@ func (s *Server) handleUnidirectionalStreams(sess quic.EarlySession) {
s.logger.Debugf("reading stream type on stream %d failed: %s", str.StreamID(), err)
return
}
if streamType != streamTypeControlStream {
// We're only interested in the control stream here.
switch streamType {
case streamTypeControlStream:
case streamTypePushStream: // only the server can push
sess.CloseWithError(quic.ErrorCode(errorStreamCreationError), "")
return
default:
return
}
f, err := parseNextFrame(str)