This is an automated email from the ASF dual-hosted git repository.

liuhan pushed a commit to branch fully-reading-buddy
in repository https://gitbox.apache.org/repos/asf/skywalking-rover.git

commit 50ca7d926205ab98de90fcc3bcf5033e6e3409fb
Author: mrproliu <741550...@qq.com>
AuthorDate: Fri Jun 6 17:50:35 2025 +0800

    Fully reading buffer
---
 .../task/network/analyze/layer7/protocols/http1/reader/reader.go | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git 
a/pkg/profiling/task/network/analyze/layer7/protocols/http1/reader/reader.go 
b/pkg/profiling/task/network/analyze/layer7/protocols/http1/reader/reader.go
index 6b4fb2a..827d615 100644
--- a/pkg/profiling/task/network/analyze/layer7/protocols/http1/reader/reader.go
+++ b/pkg/profiling/task/network/analyze/layer7/protocols/http1/reader/reader.go
@@ -20,6 +20,7 @@ package reader
 import (
        "bufio"
        "compress/gzip"
+       "errors"
        "fmt"
        "io"
        "mime"
@@ -275,15 +276,15 @@ func (m *MessageOpt) checkBodyWithSize(buf 
*buffer.Buffer, reader *bufio.Reader,
                if readSize > len(m.Reader().bodyBuffer) {
                        readSize = len(m.Reader().bodyBuffer)
                }
-               lastReadSize, err = 
reader.Read(m.Reader().bodyBuffer[0:readSize])
+               lastReadSize, err = io.ReadFull(reader, 
m.Reader().bodyBuffer[0:readSize])
                if err != nil {
-                       if err == buffer.ErrNotComplete {
+                       if errors.Is(err, buffer.ErrNotComplete) {
                                return nil, enums.ParseResultSkipPackage, nil
                        }
-                       if err == io.EOF && reduceSize-lastReadSize <= 0 {
+                       if (err == io.EOF || errors.Is(err, 
io.ErrUnexpectedEOF)) && reduceSize-lastReadSize <= 0 {
                                return nil, enums.ParseResultSuccess, nil
                        }
-                       return nil, enums.ParseResultSkipPackage, err
+                       return nil, enums.ParseResultSkipPackage, 
fmt.Errorf("reading the body error: %v", err)
                }
                reduceSize -= lastReadSize
        }

Reply via email to