github.com/HXSecurity/DongTai-agent-go@v0.4.2/core/http/httpHeaderGet/replacement.go (about)

     1  package httpHeaderGet
     2  
     3  import (
     4  	"github.com/HXSecurity/DongTai-agent-go/model/request"
     5  	"github.com/HXSecurity/DongTai-agent-go/utils"
     6  	"net/http"
     7  	"strings"
     8  )
     9  
    10  func Get(header http.Header, key string) string {
    11  	values := GetT(header, key)
    12  	skipMap := make(map[string]bool)
    13  	skipMap["net/http.(*persistConn).roundTrip"] = true
    14  	skipMap["net/http.(*chunkWriter).writeHeader"] = true
    15  	skipMap["net/http.(*Client).makeHeadersCopier"] = true
    16  	skipMap["net/http.(*persistConn).readLoop"] = true
    17  	skipMap["net/http.(*Request).requiresHTTP1"] = true
    18  	skipMap["net/http.isProtocolSwitchHeader"] = true
    19  	if strings.Index(utils.LoadFunc(2), "github.com/parnurzeal/gorequest") > -1 {
    20  		return values
    21  	}
    22  	if skipMap[utils.LoadFunc(2)] {
    23  		return values
    24  	}
    25  	request.FmtHookPool(request.PoolReq{
    26  		Args:            request.Collect(key),
    27  		Reqs:            request.Collect(values),
    28  		Source:          true,
    29  		OriginClassName: "http.(Header)",
    30  		MethodName:      "Get",
    31  		ClassName:       "http.(Header)",
    32  	})
    33  	return values
    34  }
    35  
    36  func GetT(header http.Header, key string) string {
    37  	return ""
    38  }