From 627e418287bdffac1a7c4d6144ff6e30bbfaf0fa Mon Sep 17 00:00:00 2001 From: Seb Macke Date: Fri, 23 Apr 2021 22:20:09 +1000 Subject: [PATCH] Fix missing IP in the JSON when URLs contain hostname:port --- v2/pkg/protocols/http/request.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/v2/pkg/protocols/http/request.go b/v2/pkg/protocols/http/request.go index ba19243a9..efb772bae 100644 --- a/v2/pkg/protocols/http/request.go +++ b/v2/pkg/protocols/http/request.go @@ -372,6 +372,9 @@ func (r *Request) executeRequest(reqURL string, request *generatedRequest, previ finalEvent := make(output.InternalEvent) outputEvent := r.responseToDSLMap(resp, reqURL, matchedURL, tostring.UnsafeToString(dumpedRequest), tostring.UnsafeToString(dumpedResponse), tostring.UnsafeToString(data), headersToString(resp.Header), duration, request.meta) + if i := strings.LastIndex(hostname, ":"); i != -1 { + hostname = hostname[:i] + } outputEvent["ip"] = httpclientpool.Dialer.GetDialedIP(hostname) outputEvent["redirect-chain"] = tostring.UnsafeToString(redirectedResponse) for k, v := range previous {