@@ -449,9 +449,11 @@ func (t *Translator) translateClientTrafficPolicyForListener(policy *egv1a1.Clie
449449 }
450450
451451 // Translate HTTP2 Settings
452- if err = translateHTTP2Settings (policy .Spec .HTTP2 , httpIR ); err != nil {
452+ if h2 , err := buildIRHTTP2Settings (policy .Spec .HTTP2 ); err != nil {
453453 err = perr .WithMessage (err , "HTTP2" )
454454 errs = errors .Join (errs , err )
455+ } else {
456+ httpIR .HTTP2 = h2
455457 }
456458
457459 // enable http3 if set and TLS is enabled
@@ -745,52 +747,6 @@ func translateHTTP1Settings(http1Settings *egv1a1.HTTP1Settings, connection *ir.
745747 return nil
746748}
747749
748- func translateHTTP2Settings (http2Settings * egv1a1.HTTP2Settings , httpIR * ir.HTTPListener ) error {
749- if http2Settings == nil {
750- return nil
751- }
752-
753- var (
754- http2 = & ir.HTTP2Settings {}
755- errs error
756- )
757-
758- if http2Settings .InitialStreamWindowSize != nil {
759- initialStreamWindowSize , ok := http2Settings .InitialStreamWindowSize .AsInt64 ()
760- switch {
761- case ! ok :
762- errs = errors .Join (errs , fmt .Errorf ("invalid InitialStreamWindowSize value %s" , http2Settings .InitialStreamWindowSize .String ()))
763- case initialStreamWindowSize < MinHTTP2InitialStreamWindowSize || initialStreamWindowSize > MaxHTTP2InitialStreamWindowSize :
764- errs = errors .Join (errs , fmt .Errorf ("InitialStreamWindowSize value %s is out of range, must be between %d and %d" ,
765- http2Settings .InitialStreamWindowSize .String (),
766- MinHTTP2InitialStreamWindowSize ,
767- MaxHTTP2InitialStreamWindowSize ))
768- default :
769- http2 .InitialStreamWindowSize = ptr .To (uint32 (initialStreamWindowSize ))
770- }
771- }
772-
773- if http2Settings .InitialConnectionWindowSize != nil {
774- initialConnectionWindowSize , ok := http2Settings .InitialConnectionWindowSize .AsInt64 ()
775- switch {
776- case ! ok :
777- errs = errors .Join (errs , fmt .Errorf ("invalid InitialConnectionWindowSize value %s" , http2Settings .InitialConnectionWindowSize .String ()))
778- case initialConnectionWindowSize < MinHTTP2InitialConnectionWindowSize || initialConnectionWindowSize > MaxHTTP2InitialConnectionWindowSize :
779- errs = errors .Join (errs , fmt .Errorf ("InitialConnectionWindowSize value %s is out of range, must be between %d and %d" ,
780- http2Settings .InitialConnectionWindowSize .String (),
781- MinHTTP2InitialConnectionWindowSize ,
782- MaxHTTP2InitialConnectionWindowSize ))
783- default :
784- http2 .InitialConnectionWindowSize = ptr .To (uint32 (initialConnectionWindowSize ))
785- }
786- }
787-
788- http2 .MaxConcurrentStreams = http2Settings .MaxConcurrentStreams
789-
790- httpIR .HTTP2 = http2
791- return errs
792- }
793-
794750func translateHealthCheckSettings (healthCheckSettings * egv1a1.HealthCheckSettings , httpIR * ir.HTTPListener ) {
795751 // Return early if not set
796752 if healthCheckSettings == nil {
0 commit comments