From 5546755d1a76be9bb3b6a98fb8280f8e9a17ffd1 Mon Sep 17 00:00:00 2001 From: Matus Fabian Date: Tue, 6 Aug 2024 15:55:26 +0200 Subject: http: http_read_message improvement Use svm_fifo_peek in http_read_message and advance rx fifo head by amount of bytes send to app, since not always you won't or can't send all bytes. Type: improvement Change-Id: I84348c9df5c77ba386c9738a754295bb9ea0f7ef Signed-off-by: Matus Fabian --- extras/hs-test/http_test.go | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'extras/hs-test/http_test.go') diff --git a/extras/hs-test/http_test.go b/extras/hs-test/http_test.go index 8f8946fa32e..1f3a5f35b74 100644 --- a/extras/hs-test/http_test.go +++ b/extras/hs-test/http_test.go @@ -31,7 +31,7 @@ func init() { HttpHeadersTest, HttpStaticFileHandlerTest, HttpClientTest, HttpClientErrRespTest, HttpClientPostFormTest, HttpClientPostFileTest, HttpClientPostFilePtrTest, AuthorityFormTargetTest) RegisterNoTopoSoloTests(HttpStaticPromTest, HttpTpsTest, HttpTpsInterruptModeTest, PromConcurrentConnectionsTest, - PromMemLeakTest, HttpClientPostMemLeakTest) + PromMemLeakTest, HttpClientPostMemLeakTest, HttpInvalidClientRequestMemLeakTest) } const wwwRootPath = "/tmp/www_root" @@ -501,6 +501,40 @@ func HttpClientPostMemLeakTest(s *NoTopoSuite) { vpp.MemLeakCheck(traces1, traces2) } +func HttpInvalidClientRequestMemLeakTest(s *NoTopoSuite) { + s.SkipUnlessLeakCheck() + + vpp := s.GetContainerByName("vpp").VppInstance + serverAddress := s.GetInterfaceByName(TapInterfaceName).Peer.Ip4AddressString() + + /* no goVPP less noise */ + vpp.Disconnect() + + vpp.Vppctl("http cli server") + + /* warmup request (FIB) */ + _, err := TcpSendReceive(serverAddress+":80", "GET / HTTP/1.1\r\n") + s.AssertNil(err, fmt.Sprint(err)) + + /* let's give it some time to clean up sessions, so local port can be reused and we have less noise */ + time.Sleep(time.Second * 12) + + vpp.EnableMemoryTrace() + traces1, err := vpp.GetMemoryTrace() + s.AssertNil(err, fmt.Sprint(err)) + + _, err = TcpSendReceive(serverAddress+":80", "GET / HTTP/1.1\r\n") + s.AssertNil(err, fmt.Sprint(err)) + + /* let's give it some time to clean up sessions */ + time.Sleep(time.Second * 12) + + traces2, err := vpp.GetMemoryTrace() + s.AssertNil(err, fmt.Sprint(err)) + vpp.MemLeakCheck(traces1, traces2) + +} + func HttpStaticFileHandlerTest(s *NoTopoSuite) { content := "

Hello

" content2 := "

Page

" -- cgit 1.2.3-korg