From 70ee525261f7d8adbcf58c2cf54efb7e7efb1c82 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 13 Jan 2016 16:30:00 +0000 Subject: net/http: fix Transport crash when abandoning dial which upgrades protos When the Transport was creating an bound HTTP connection (protocol unknown initially) and then ends up deciding it doesn't need it, a goroutine sits around to clean up whatever the result was. That goroutine made the false assumption that the result was always an HTTP/1 connection or an error. It may also be an alternate protocol in which case the *persistConn.conn net.Conn field is nil, and the alt field is non-nil. Fixes #13839 Change-Id: Ia4972e5eb1ad53fa00410b3466d4129c753e0871 Reviewed-on: https://go-review.googlesource.com/18573 Reviewed-by: Russ Cox Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- src/net/http/export_test.go | 1 + 1 file changed, 1 insertion(+) (limited to 'src/net/http/export_test.go') diff --git a/src/net/http/export_test.go b/src/net/http/export_test.go index 514d02b2a3..52bccbdce3 100644 --- a/src/net/http/export_test.go +++ b/src/net/http/export_test.go @@ -21,6 +21,7 @@ var ( ExportServerNewConn = (*Server).newConn ExportCloseWriteAndWait = (*conn).closeWriteAndWait ExportErrRequestCanceled = errRequestCanceled + ExportErrRequestCanceledConn = errRequestCanceledConn ExportServeFile = serveFile ExportHttp2ConfigureTransport = http2ConfigureTransport ExportHttp2ConfigureServer = http2ConfigureServer -- cgit v1.3