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
|
initialMaxDataParameterID transportParameterID = 0x1
|
||||||
initialMaxStreamsBiDiParameterID transportParameterID = 0x2
|
initialMaxStreamsBiDiParameterID transportParameterID = 0x2
|
||||||
idleTimeoutParameterID transportParameterID = 0x3
|
idleTimeoutParameterID transportParameterID = 0x3
|
||||||
omitConnectionIDParameterID transportParameterID = 0x4
|
|
||||||
maxPacketSizeParameterID transportParameterID = 0x5
|
maxPacketSizeParameterID transportParameterID = 0x5
|
||||||
statelessResetTokenParameterID transportParameterID = 0x6
|
statelessResetTokenParameterID transportParameterID = 0x6
|
||||||
initialMaxStreamsUniParameterID transportParameterID = 0x8
|
initialMaxStreamsUniParameterID transportParameterID = 0x8
|
||||||
|
|||||||
@@ -116,10 +116,9 @@ var _ = Describe("Transport Parameters", func() {
|
|||||||
ConnectionFlowControlWindow: 0x4321,
|
ConnectionFlowControlWindow: 0x4321,
|
||||||
MaxBidiStreams: 1337,
|
MaxBidiStreams: 1337,
|
||||||
MaxUniStreams: 7331,
|
MaxUniStreams: 7331,
|
||||||
OmitConnectionID: true,
|
|
||||||
IdleTimeout: 42 * time.Second,
|
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() {
|
Context("parsing", func() {
|
||||||
@@ -147,13 +146,6 @@ var _ = Describe("Transport Parameters", func() {
|
|||||||
Expect(params.MaxPacketSize).To(Equal(protocol.ByteCount(0x7331)))
|
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() {
|
It("rejects the parameters if the initial_max_stream_data is missing", func() {
|
||||||
delete(parameters, initialMaxStreamDataParameterID)
|
delete(parameters, initialMaxStreamDataParameterID)
|
||||||
_, err := readTransportParameters(paramsMapToList(parameters))
|
_, 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)"))
|
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() {
|
It("rejects the parameters if max_packet_size has the wrong length", func() {
|
||||||
parameters[maxPacketSizeParameterID] = []byte{0x11} // should be 2 bytes
|
parameters[maxPacketSizeParameterID] = []byte{0x11} // should be 2 bytes
|
||||||
_, err := readTransportParameters(paramsMapToList(parameters))
|
_, 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(idleTimeoutParameterID, []byte{0xca, 0xfe}))
|
||||||
Expect(values).To(HaveKeyWithValue(maxPacketSizeParameterID, []byte{0x5, 0xac})) // 1452 = 0x5ac
|
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
|
MaxBidiStreams uint16 // only used for IETF QUIC
|
||||||
MaxStreams uint32 // only used for gQUIC
|
MaxStreams uint32 // only used for gQUIC
|
||||||
|
|
||||||
OmitConnectionID bool
|
OmitConnectionID bool // only used for gQUIC
|
||||||
IdleTimeout time.Duration
|
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))
|
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)
|
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:
|
case maxPacketSizeParameterID:
|
||||||
if len(p.Value) != 2 {
|
if len(p.Value) != 2 {
|
||||||
return nil, fmt.Errorf("wrong length for max_packet_size: %d (expected 2)", len(p.Value))
|
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},
|
{idleTimeoutParameterID, idleTimeout},
|
||||||
{maxPacketSizeParameterID, maxPacketSize},
|
{maxPacketSizeParameterID, maxPacketSize},
|
||||||
}
|
}
|
||||||
if p.OmitConnectionID {
|
|
||||||
params = append(params, transportParameter{omitConnectionIDParameterID, []byte{}})
|
|
||||||
}
|
|
||||||
return params
|
return params
|
||||||
}
|
}
|
||||||
|
|
||||||
// String returns a string representation, intended for logging.
|
// String returns a string representation, intended for logging.
|
||||||
// It should only used for IETF QUIC.
|
// It should only used for IETF QUIC.
|
||||||
func (p *TransportParameters) String() string {
|
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