forked from quic-go/quic-go
fix typo in function name
This commit is contained in:
@@ -118,7 +118,7 @@ func (h *extensionHandlerClient) Receive(hType mint.HandshakeType, el *mint.Exte
|
||||
// TODO: return the right error here
|
||||
return errors.New("server didn't sent stateless_reset_token")
|
||||
}
|
||||
params, err := readTransportParamters(eetp.Parameters)
|
||||
params, err := readTransportParameters(eetp.Parameters)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ func (h *extensionHandlerServer) Receive(hType mint.HandshakeType, el *mint.Exte
|
||||
return errors.New("client sent a stateless reset token")
|
||||
}
|
||||
}
|
||||
params, err := readTransportParamters(chtp.Parameters)
|
||||
params, err := readTransportParameters(chtp.Parameters)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ var _ = Describe("Transport Parameters", func() {
|
||||
}
|
||||
})
|
||||
It("reads parameters", func() {
|
||||
params, err := readTransportParamters(paramsMapToList(parameters))
|
||||
params, err := readTransportParameters(paramsMapToList(parameters))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(params.StreamFlowControlWindow).To(Equal(protocol.ByteCount(0x11223344)))
|
||||
Expect(params.ConnectionFlowControlWindow).To(Equal(protocol.ByteCount(0x22334455)))
|
||||
@@ -149,26 +149,26 @@ var _ = Describe("Transport Parameters", func() {
|
||||
|
||||
It("saves if it should omit the connection ID", func() {
|
||||
parameters[omitConnectionIDParameterID] = []byte{}
|
||||
params, err := readTransportParamters(paramsMapToList(parameters))
|
||||
params, err := readTransportParameters(paramsMapToList(parameters))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(params.OmitConnectionID).To(BeTrue())
|
||||
})
|
||||
|
||||
It("rejects the parameters if the initial_max_stream_data is missing", func() {
|
||||
delete(parameters, initialMaxStreamDataParameterID)
|
||||
_, err := readTransportParamters(paramsMapToList(parameters))
|
||||
_, err := readTransportParameters(paramsMapToList(parameters))
|
||||
Expect(err).To(MatchError("missing parameter"))
|
||||
})
|
||||
|
||||
It("rejects the parameters if the initial_max_data is missing", func() {
|
||||
delete(parameters, initialMaxDataParameterID)
|
||||
_, err := readTransportParamters(paramsMapToList(parameters))
|
||||
_, err := readTransportParameters(paramsMapToList(parameters))
|
||||
Expect(err).To(MatchError("missing parameter"))
|
||||
})
|
||||
|
||||
It("rejects the parameters if the idle_timeout is missing", func() {
|
||||
delete(parameters, idleTimeoutParameterID)
|
||||
_, err := readTransportParamters(paramsMapToList(parameters))
|
||||
_, err := readTransportParameters(paramsMapToList(parameters))
|
||||
Expect(err).To(MatchError("missing parameter"))
|
||||
})
|
||||
|
||||
@@ -176,62 +176,62 @@ var _ = Describe("Transport Parameters", func() {
|
||||
t := 2 * time.Second
|
||||
Expect(t).To(BeNumerically("<", protocol.MinRemoteIdleTimeout))
|
||||
parameters[idleTimeoutParameterID] = []byte{0, uint8(t.Seconds())}
|
||||
params, err := readTransportParamters(paramsMapToList(parameters))
|
||||
params, err := readTransportParameters(paramsMapToList(parameters))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(params.IdleTimeout).To(Equal(protocol.MinRemoteIdleTimeout))
|
||||
})
|
||||
|
||||
It("rejects the parameters if the initial_max_stream_data has the wrong length", func() {
|
||||
parameters[initialMaxStreamDataParameterID] = []byte{0x11, 0x22, 0x33} // should be 4 bytes
|
||||
_, err := readTransportParamters(paramsMapToList(parameters))
|
||||
_, err := readTransportParameters(paramsMapToList(parameters))
|
||||
Expect(err).To(MatchError("wrong length for initial_max_stream_data: 3 (expected 4)"))
|
||||
})
|
||||
|
||||
It("rejects the parameters if the initial_max_data has the wrong length", func() {
|
||||
parameters[initialMaxDataParameterID] = []byte{0x11, 0x22, 0x33} // should be 4 bytes
|
||||
_, err := readTransportParamters(paramsMapToList(parameters))
|
||||
_, err := readTransportParameters(paramsMapToList(parameters))
|
||||
Expect(err).To(MatchError("wrong length for initial_max_data: 3 (expected 4)"))
|
||||
})
|
||||
|
||||
It("rejects the parameters if the initial_max_stream_id_bidi has the wrong length", func() {
|
||||
parameters[initialMaxStreamIDBiDiParameterID] = []byte{0x11, 0x22, 0x33, 0x44, 0x55} // should be 4 bytes
|
||||
_, err := readTransportParamters(paramsMapToList(parameters))
|
||||
_, err := readTransportParameters(paramsMapToList(parameters))
|
||||
Expect(err).To(MatchError("wrong length for initial_max_stream_id_bidi: 5 (expected 4)"))
|
||||
})
|
||||
|
||||
It("rejects the parameters if the initial_max_stream_id_bidi has the wrong length", func() {
|
||||
parameters[initialMaxStreamIDUniParameterID] = []byte{0x11, 0x22, 0x33, 0x44, 0x55} // should be 4 bytes
|
||||
_, err := readTransportParamters(paramsMapToList(parameters))
|
||||
_, err := readTransportParameters(paramsMapToList(parameters))
|
||||
Expect(err).To(MatchError("wrong length for initial_max_stream_id_uni: 5 (expected 4)"))
|
||||
})
|
||||
|
||||
It("rejects the parameters if the initial_idle_timeout has the wrong length", func() {
|
||||
parameters[idleTimeoutParameterID] = []byte{0x11, 0x22, 0x33} // should be 2 bytes
|
||||
_, err := readTransportParamters(paramsMapToList(parameters))
|
||||
_, err := readTransportParameters(paramsMapToList(parameters))
|
||||
Expect(err).To(MatchError("wrong length for idle_timeout: 3 (expected 2)"))
|
||||
})
|
||||
|
||||
It("rejects the parameters if omit_connection_id is non-empty", func() {
|
||||
parameters[omitConnectionIDParameterID] = []byte{0} // should be empty
|
||||
_, err := readTransportParamters(paramsMapToList(parameters))
|
||||
_, err := readTransportParameters(paramsMapToList(parameters))
|
||||
Expect(err).To(MatchError("wrong length for omit_connection_id: 1 (expected empty)"))
|
||||
})
|
||||
|
||||
It("rejects the parameters if max_packet_size has the wrong length", func() {
|
||||
parameters[maxPacketSizeParameterID] = []byte{0x11} // should be 2 bytes
|
||||
_, err := readTransportParamters(paramsMapToList(parameters))
|
||||
_, err := readTransportParameters(paramsMapToList(parameters))
|
||||
Expect(err).To(MatchError("wrong length for max_packet_size: 1 (expected 2)"))
|
||||
})
|
||||
|
||||
It("rejects max_packet_sizes smaller than 1200 bytes", func() {
|
||||
parameters[maxPacketSizeParameterID] = []byte{0x4, 0xaf} // 0x4af = 1199
|
||||
_, err := readTransportParamters(paramsMapToList(parameters))
|
||||
_, err := readTransportParameters(paramsMapToList(parameters))
|
||||
Expect(err).To(MatchError("invalid value for max_packet_size: 1199 (minimum 1200)"))
|
||||
})
|
||||
|
||||
It("ignores unknown parameters", func() {
|
||||
parameters[1337] = []byte{42}
|
||||
_, err := readTransportParamters(paramsMapToList(parameters))
|
||||
_, err := readTransportParameters(paramsMapToList(parameters))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
})
|
||||
|
||||
@@ -95,7 +95,7 @@ func (p *TransportParameters) getHelloMap() map[Tag][]byte {
|
||||
}
|
||||
|
||||
// readTransportParameters reads the transport parameters sent in the QUIC TLS extension
|
||||
func readTransportParamters(paramsList []transportParameter) (*TransportParameters, error) {
|
||||
func readTransportParameters(paramsList []transportParameter) (*TransportParameters, error) {
|
||||
params := &TransportParameters{}
|
||||
|
||||
var foundInitialMaxStreamData bool
|
||||
|
||||
Reference in New Issue
Block a user