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

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


The following commit(s) were added to refs/heads/main by this push:
     new ab76f3e  Fix HTTP method name in protocol analyzer (#71)
ab76f3e is described below

commit ab76f3e6cd4cbeb695780e315ca2ee28884398d8
Author: 罗泽轩 <[email protected]>
AuthorDate: Fri Jan 13 15:06:48 2023 +0800

    Fix HTTP method name in protocol analyzer (#71)
---
 CHANGES.md                                                        | 1 +
 bpf/profiling/network/protocol_analyzer.h                         | 8 ++++++--
 .../task/network/analyze/layer7/protocols/http1/reader/reader.go  | 2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 01abf52..1a88c37 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -8,6 +8,7 @@ Release Notes.
 * Enhance the protocol reader for support long socket data.
 
 #### Bug Fixes
+* Fix HTTP method name in protocol analyzer
 * Fixed submitting multiple network profiling tasks with the same uri causing 
the rover to restart
 
 #### Documentation
diff --git a/bpf/profiling/network/protocol_analyzer.h 
b/bpf/profiling/network/protocol_analyzer.h
index e6a7838..3f22d90 100644
--- a/bpf/profiling/network/protocol_analyzer.h
+++ b/bpf/profiling/network/protocol_analyzer.h
@@ -45,7 +45,9 @@ static __inline __u32 infer_http1_message(const char* buf, 
size_t count) {
     if (buf[0] == 'P' && buf[1] == 'O' && buf[2] == 'S' && buf[3] == 'T') {
         return CONNECTION_MESSAGE_TYPE_REQUEST;
     }
-    if (buf[0] == 'O' && buf[1] == 'P' && buf[2] == 'T' && buf[3] == 'I' && 
buf[4] == 'O' && buf[5] == 'N') {
+    if (buf[0] == 'O' && buf[1] == 'P' && buf[2] == 'T' && buf[3] == 'I' && 
buf[4] == 'O'
+        && buf[5] == 'N' && buf[6] == 'S')
+    {
         return CONNECTION_MESSAGE_TYPE_REQUEST;
     }
     if (buf[0] == 'H' && buf[1] == 'E' && buf[2] == 'A' && buf[3] == 'D') {
@@ -57,7 +59,9 @@ static __inline __u32 infer_http1_message(const char* buf, 
size_t count) {
     if (buf[0] == 'D' && buf[1] == 'E' && buf[2] == 'L' && buf[3] == 'E' && 
buf[4] == 'T' && buf[5] == 'E') {
         return CONNECTION_MESSAGE_TYPE_REQUEST;
     }
-    if (buf[0] == 'C' && buf[1] == 'O' && buf[2] == 'N' && buf[3] == 'N' && 
buf[4] == 'E' && buf[5] == 'T') {
+    if (buf[0] == 'C' && buf[1] == 'O' && buf[2] == 'N' && buf[3] == 'N' && 
buf[4] == 'E'
+        && buf[5] == 'C' && buf[6] == 'T')
+    {
         return CONNECTION_MESSAGE_TYPE_REQUEST;
     }
     if (buf[0] == 'T' && buf[1] == 'R' && buf[2] == 'A' && buf[3] == 'C' && 
buf[4] == 'E') {
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 90863e8..ace2a13 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
@@ -40,7 +40,7 @@ var (
        bodyBuffer = make([]byte, 4096)
 
        requestMethods = []string{
-               "GET", "POST", "OPTION", "HEAD", "PUT", "DELETE", "CONNECT", 
"TRACE", "PATCH",
+               "GET", "POST", "OPTIONS", "HEAD", "PUT", "DELETE", "CONNECT", 
"TRACE", "PATCH",
        }
 )
 

Reply via email to