From cedd4f3b5462195930a52c574d8cab62499fd926 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sat, 31 Jul 2021 12:38:10 +0200 Subject: [PATCH] xtransport: properly forward the status code on error --- dnscrypt-proxy/xtransport.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dnscrypt-proxy/xtransport.go b/dnscrypt-proxy/xtransport.go index cd76888a..2f8a6f42 100644 --- a/dnscrypt-proxy/xtransport.go +++ b/dnscrypt-proxy/xtransport.go @@ -409,12 +409,12 @@ func (xTransport *XTransport) Fetch(method string, url *url.URL, accept string, xTransport.tlsCipherSuite = nil xTransport.rebuildTransport() } - return nil, 0, nil, 0, err + return nil, resp.StatusCode, nil, rtt, err } tls := resp.TLS bin, err := ioutil.ReadAll(io.LimitReader(resp.Body, MaxHTTPBodyLength)) if err != nil { - return nil, resp.StatusCode, tls, 0, err + return nil, resp.StatusCode, tls, rtt, err } resp.Body.Close() return bin, resp.StatusCode, tls, rtt, err