[tor-commits] [obfs4/master] Annotate use of deprecated `net/http/httputil` package

yawning at torproject.org yawning at torproject.org
Sat Jan 19 11:43:35 UTC 2019


commit a83ca3c9fe7a3adbbcd9a376fb5de988db185440
Author: Yawning Angel <yawning at schwanenlied.me>
Date:   Sat Jan 19 11:19:02 2019 +0000

    Annotate use of deprecated `net/http/httputil` package
    
    This is to silence some of the static analysis tools used in
    development.  Despite `http.Client` and `http.Transport` being
    suggested as an alternative, there is no way to accomplish current
    functionality with either suggested replacement.
    
    See: https://github.com/golang/go/issues/8285
---
 obfs4proxy/proxy_http.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/obfs4proxy/proxy_http.go b/obfs4proxy/proxy_http.go
index c108943..35ec737 100644
--- a/obfs4proxy/proxy_http.go
+++ b/obfs4proxy/proxy_http.go
@@ -69,7 +69,7 @@ func (s *httpProxy) Dial(network, addr string) (net.Conn, error) {
 		return nil, err
 	}
 	conn := new(httpConn)
-	conn.httpConn = httputil.NewClientConn(c, nil)
+	conn.httpConn = httputil.NewClientConn(c, nil) // nolint: staticcheck
 	conn.remoteAddr, err = net.ResolveTCPAddr(network, addr)
 	if err != nil {
 		conn.httpConn.Close()
@@ -98,7 +98,7 @@ func (s *httpProxy) Dial(network, addr string) (net.Conn, error) {
 	req.Header.Set("User-Agent", "")
 
 	resp, err := conn.httpConn.Do(req)
-	if err != nil && err != httputil.ErrPersistEOF {
+	if err != nil && err != httputil.ErrPersistEOF { // nolint: staticcheck
 		conn.httpConn.Close()
 		return nil, err
 	}
@@ -113,7 +113,7 @@ func (s *httpProxy) Dial(network, addr string) (net.Conn, error) {
 
 type httpConn struct {
 	remoteAddr   *net.TCPAddr
-	httpConn     *httputil.ClientConn
+	httpConn     *httputil.ClientConn // nolint: staticcheck
 	hijackedConn net.Conn
 	staleReader  *bufio.Reader
 }





More information about the tor-commits mailing list