Remove SetHostname method in HTTP extension (#496)

This commit is contained in:
M. Mert Yıldıran 2021-11-22 19:30:06 +03:00 committed by GitHub
parent 12ca3d8779
commit d66c7445e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -124,15 +124,6 @@ func (d dissecting) Dissect(b *bufio.Reader, isClient bool, tcpID *api.TcpID, co
return nil
}
func SetHostname(address, newHostname string) string {
replacedUrl, err := url.Parse(address)
if err != nil {
return address
}
replacedUrl.Host = newHostname
return replacedUrl.String()
}
func (d dissecting) Analyze(item *api.OutputChannelItem, resolvedSource string, resolvedDestination string) *api.MizuEntry {
var host, authority, path, service string
@ -189,9 +180,9 @@ func (d dissecting) Analyze(item *api.OutputChannelItem, resolvedSource string,
reqDetails["queryString"] = mapSliceRebuildAsMap(reqDetails["_queryString"].([]interface{}))
if resolvedDestination != "" {
service = SetHostname(service, resolvedDestination)
service = resolvedDestination
} else if resolvedSource != "" {
service = SetHostname(service, resolvedSource)
service = resolvedSource
}
method := reqDetails["method"].(string)