replayTargetHasHTTP2Mock reports whether a kind:Http2 mock was recorded for THIS connection's destination (sniHost + port). ALPN is negotiated per-connection before any request is seen, so the decision must be scoped to the destination being dialed: a session-global check ("any Http2 mock at all") w
(sniHost string, port uint32)
| 898 | // load after it was built and carry a destination's h2 preference into a later |
| 899 | // test-set where that destination is HTTP/1.1-only. |
| 900 | func (p *Proxy) replayTargetHasHTTP2Mock(sniHost string, port uint32) bool { |
| 901 | m := p.getMockManager() |
| 902 | if m == nil { |
| 903 | return false |
| 904 | } |
| 905 | return m.HasMocksByKind(models.HTTP2, func(mk *models.Mock) bool { |
| 906 | if mk.Spec.HTTP2Req == nil { |
| 907 | return false |
| 908 | } |
| 909 | h, pt := hostPortFromAuthority(mk.Spec.HTTP2Req.Authority, mk.Spec.HTTP2Req.Scheme) |
| 910 | return http2DestMatches(strings.ToLower(h), pt, sniHost, port) |
| 911 | }) |
| 912 | } |
| 913 | |
| 914 | // http2DestMatches reports whether a recorded Http2 destination (aHost:aPort, |
| 915 | // aHost lower-cased) matches the connection destination sniHost:port. A |
no test coverage detected