diff options
author | 2025-01-12 22:18:56 +0100 | |
---|---|---|
committer | 2025-01-21 13:47:28 -0500 | |
commit | 98d1264fcdb81c1213e1d0ac02098a3f6673631a (patch) | |
tree | 71fa5fe3da48681c64419bc6ceab24e2f442fb42 /extras/hs-test/proxy_test.go | |
parent | 98028dd4c475f8929cf07a87114e857bfc6bda93 (diff) |
http: target parsing improvement
Make it http version neutral, since h2 and h3 use 3 pseudo-headers.
Added scheme, target_authority_offset and target_authority_len
to http_msg_data_t, target_form removed.
Http transport now validate if correct form of request target
is received, so now we are also able to receive requests with
absolute-form target in server apps like http_static.
As bonus, unformat is not longer used to parse IP addresses.
Type: improvement
Change-Id: I369f77e2639c43cc1244d91f883c526eb88af63e
Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'extras/hs-test/proxy_test.go')
-rw-r--r-- | extras/hs-test/proxy_test.go | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/extras/hs-test/proxy_test.go b/extras/hs-test/proxy_test.go index ec90d24ba36..192451fe8f4 100644 --- a/extras/hs-test/proxy_test.go +++ b/extras/hs-test/proxy_test.go @@ -26,7 +26,7 @@ func init() { RegisterVppProxySoloTests(VppProxyHttpGetTcpMTTest, VppProxyHttpPutTcpMTTest, VppProxyTcpIperfMTTest, VppProxyUdpIperfMTTest, VppConnectProxyStressTest, VppConnectProxyStressMTTest, VppConnectProxyConnectionFailedMTTest) RegisterVppUdpProxyTests(VppProxyUdpTest, VppConnectUdpProxyTest, VppConnectUdpInvalidCapsuleTest, - VppConnectUdpUnknownCapsuleTest, VppConnectUdpClientCloseTest) + VppConnectUdpUnknownCapsuleTest, VppConnectUdpClientCloseTest, VppConnectUdpInvalidTargetTest) RegisterVppUdpProxySoloTests(VppProxyUdpMigrationMTTest, VppConnectUdpStressMTTest, VppConnectUdpStressTest) RegisterEnvoyProxyTests(EnvoyProxyHttpGetTcpTest, EnvoyProxyHttpPutTcpTest) RegisterNginxProxyTests(NginxMirroringTest) @@ -411,6 +411,29 @@ func VppConnectUdpProxyTest(s *VppUdpProxySuite) { s.AssertEqual(data, payload) } +func VppConnectUdpInvalidTargetTest(s *VppUdpProxySuite) { + vppProxy := s.Containers.VppProxy.VppInstance + cmd := fmt.Sprintf("test proxy server fifo-size 512k server-uri http://%s/%d", s.VppProxyAddr(), s.ProxyPort()) + s.Log(vppProxy.Vppctl(cmd)) + + proxyAddress := fmt.Sprintf("%s:%d", s.VppProxyAddr(), s.ProxyPort()) + + targetUri := fmt.Sprintf("http://%s:%d/.well-known/masque/udp/example.com/80/", s.VppProxyAddr(), s.ProxyPort()) + c := s.NewConnectUdpClient(s.MaxTimeout, true) + err := c.Dial(proxyAddress, targetUri) + s.AssertNotNil(err, "name resolution not supported") + + targetUri = fmt.Sprintf("http://%s:%d/.well-known/masque/udp/1.2.3.4/800000000/", s.VppProxyAddr(), s.ProxyPort()) + c = s.NewConnectUdpClient(s.MaxTimeout, true) + err = c.Dial(proxyAddress, targetUri) + s.AssertNotNil(err, "invalid port number") + + targetUri = fmt.Sprintf("http://%s:%d/masque/udp/1.2.3.4/80/", s.VppProxyAddr(), s.ProxyPort()) + c = s.NewConnectUdpClient(s.MaxTimeout, true) + err = c.Dial(proxyAddress, targetUri) + s.AssertNotNil(err, "invalid prefix") +} + func VppConnectUdpInvalidCapsuleTest(s *VppUdpProxySuite) { remoteServerConn := s.StartEchoServer() defer remoteServerConn.Close() |