forked from quic-go/quic-go
remove the omit_connection_id TLS transport parameter
This commit is contained in:
@@ -13,7 +13,6 @@ const (
|
||||
initialMaxDataParameterID transportParameterID = 0x1
|
||||
initialMaxStreamsBiDiParameterID transportParameterID = 0x2
|
||||
idleTimeoutParameterID transportParameterID = 0x3
|
||||
omitConnectionIDParameterID transportParameterID = 0x4
|
||||
maxPacketSizeParameterID transportParameterID = 0x5
|
||||
statelessResetTokenParameterID transportParameterID = 0x6
|
||||
initialMaxStreamsUniParameterID transportParameterID = 0x8
|
||||
|
||||
@@ -116,10 +116,9 @@ var _ = Describe("Transport Parameters", func() {
|
||||
ConnectionFlowControlWindow: 0x4321,
|
||||
MaxBidiStreams: 1337,
|
||||
MaxUniStreams: 7331,
|
||||
OmitConnectionID: true,
|
||||
IdleTimeout: 42 * time.Second,
|
||||
}
|
||||
Expect(p.String()).To(Equal("&handshake.TransportParameters{StreamFlowControlWindow: 0x1234, ConnectionFlowControlWindow: 0x4321, MaxBidiStreams: 1337, MaxUniStreams: 7331, OmitConnectionID: true, IdleTimeout: 42s}"))
|
||||
Expect(p.String()).To(Equal("&handshake.TransportParameters{StreamFlowControlWindow: 0x1234, ConnectionFlowControlWindow: 0x4321, MaxBidiStreams: 1337, MaxUniStreams: 7331, IdleTimeout: 42s}"))
|
||||
})
|
||||
|
||||
Context("parsing", func() {
|
||||
@@ -147,13 +146,6 @@ var _ = Describe("Transport Parameters", func() {
|
||||
Expect(params.MaxPacketSize).To(Equal(protocol.ByteCount(0x7331)))
|
||||
})
|
||||
|
||||
It("saves if it should omit the connection ID", func() {
|
||||
parameters[omitConnectionIDParameterID] = []byte{}
|
||||
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 := readTransportParameters(paramsMapToList(parameters))
|
||||
@@ -211,12 +203,6 @@ var _ = Describe("Transport Parameters", func() {
|
||||
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 := 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 := readTransportParameters(paramsMapToList(parameters))
|
||||
@@ -267,12 +253,6 @@ var _ = Describe("Transport Parameters", func() {
|
||||
Expect(values).To(HaveKeyWithValue(idleTimeoutParameterID, []byte{0xca, 0xfe}))
|
||||
Expect(values).To(HaveKeyWithValue(maxPacketSizeParameterID, []byte{0x5, 0xac})) // 1452 = 0x5ac
|
||||
})
|
||||
|
||||
It("request ommission of the connection ID", func() {
|
||||
params.OmitConnectionID = true
|
||||
values := paramsListToMap(params.getTransportParameters())
|
||||
Expect(values).To(HaveKeyWithValue(omitConnectionIDParameterID, []byte{}))
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -26,7 +26,7 @@ type TransportParameters struct {
|
||||
MaxBidiStreams uint16 // only used for IETF QUIC
|
||||
MaxStreams uint32 // only used for gQUIC
|
||||
|
||||
OmitConnectionID bool
|
||||
OmitConnectionID bool // only used for gQUIC
|
||||
IdleTimeout time.Duration
|
||||
}
|
||||
|
||||
@@ -132,11 +132,6 @@ func readTransportParameters(paramsList []transportParameter) (*TransportParamet
|
||||
return nil, fmt.Errorf("wrong length for idle_timeout: %d (expected 2)", len(p.Value))
|
||||
}
|
||||
params.IdleTimeout = utils.MaxDuration(protocol.MinRemoteIdleTimeout, time.Duration(binary.BigEndian.Uint16(p.Value))*time.Second)
|
||||
case omitConnectionIDParameterID:
|
||||
if len(p.Value) != 0 {
|
||||
return nil, fmt.Errorf("wrong length for omit_connection_id: %d (expected empty)", len(p.Value))
|
||||
}
|
||||
params.OmitConnectionID = true
|
||||
case maxPacketSizeParameterID:
|
||||
if len(p.Value) != 2 {
|
||||
return nil, fmt.Errorf("wrong length for max_packet_size: %d (expected 2)", len(p.Value))
|
||||
@@ -178,14 +173,11 @@ func (p *TransportParameters) getTransportParameters() []transportParameter {
|
||||
{idleTimeoutParameterID, idleTimeout},
|
||||
{maxPacketSizeParameterID, maxPacketSize},
|
||||
}
|
||||
if p.OmitConnectionID {
|
||||
params = append(params, transportParameter{omitConnectionIDParameterID, []byte{}})
|
||||
}
|
||||
return params
|
||||
}
|
||||
|
||||
// String returns a string representation, intended for logging.
|
||||
// It should only used for IETF QUIC.
|
||||
func (p *TransportParameters) String() string {
|
||||
return fmt.Sprintf("&handshake.TransportParameters{StreamFlowControlWindow: %#x, ConnectionFlowControlWindow: %#x, MaxBidiStreams: %d, MaxUniStreams: %d, OmitConnectionID: %t, IdleTimeout: %s}", p.StreamFlowControlWindow, p.ConnectionFlowControlWindow, p.MaxBidiStreams, p.MaxUniStreams, p.OmitConnectionID, p.IdleTimeout)
|
||||
return fmt.Sprintf("&handshake.TransportParameters{StreamFlowControlWindow: %#x, ConnectionFlowControlWindow: %#x, MaxBidiStreams: %d, MaxUniStreams: %d, IdleTimeout: %s}", p.StreamFlowControlWindow, p.ConnectionFlowControlWindow, p.MaxBidiStreams, p.MaxUniStreams, p.IdleTimeout)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user