Skip to content

Commit

Permalink
Refactor: delete magic number (#522)
Browse files Browse the repository at this point in the history
  • Loading branch information
lwangrabbit authored Jan 2, 2024
1 parent 3753eeb commit ef62938
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/internal/ebpf/httpfltr/httpfltr.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,13 +337,15 @@ func (event *BPFHTTPInfo) method() string {

func (event *BPFHTTPInfo) hostFromBuf() (string, int) {
buf := cstr(event.Buf[:])
idx := strings.Index(buf, "Host: ")

host := "Host: "
idx := strings.Index(buf, host)

if idx < 0 {
return "", -1
}

buf = buf[idx+6:]
buf = buf[idx+len(host):]

rIdx := strings.Index(buf, "\r")

Expand Down

0 comments on commit ef62938

Please sign in to comment.