diff --git a/probe/plugins/registry.go b/probe/plugins/registry.go index 64967024c..fb5f3c5cf 100644 --- a/probe/plugins/registry.go +++ b/probe/plugins/registry.go @@ -290,7 +290,7 @@ func (p *Plugin) get(path string, params url.Values, result interface{}) error { // Context here lets us either timeout req. or cancel it in Plugin.Close ctx, cancel := context.WithTimeout(p.context, pluginTimeout) defer cancel() - resp, err := ctxhttp.Get(ctx, p.client, fmt.Sprintf("unix://%s?%s", path, params.Encode())) + resp, err := ctxhttp.Get(ctx, p.client, fmt.Sprintf("http://plugin%s?%s", path, params.Encode())) if err != nil { return err } diff --git a/probe/plugins/unix_round_tripper.go b/probe/plugins/unix_round_tripper.go index 0bbd49b51..1220df9d4 100644 --- a/probe/plugins/unix_round_tripper.go +++ b/probe/plugins/unix_round_tripper.go @@ -3,25 +3,14 @@ package plugins import ( "net" "net/http" - "net/http/httputil" "time" ) -type unixRoundTripper struct { - address string - timeout time.Duration -} - func makeUnixRoundTripper(address string, timeout time.Duration) (http.RoundTripper, error) { - return unixRoundTripper{address: address, timeout: timeout}, nil -} - -func (t unixRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { - conn, err := net.DialTimeout("unix", t.address, t.timeout) - if err != nil { - return nil, err + rt := &http.Transport{ + Dial: func(proto, addr string) (conn net.Conn, err error) { + return net.DialTimeout("unix", address, timeout) + }, } - client := httputil.NewClientConn(conn, nil) - defer client.Close() - return client.Do(req) + return rt, nil }