On Thu, Jan 24, 2019 at 07:33:39AM +0000, Yawning Angel wrote: > On 1/24/19 6:47 AM, David Fifield wrote: > > // This also assumes that req.URL.Host will remain constant for the > > // lifetime of the roundTripper, which is a valid assumption for > > meeklite. > > > > Am I wrong, or is the actual restriction less strict? You can reuse the > > roundTripper for different hosts--the ServerName is taken from the addr > > argument to dialTLS--but only if those different hosts negotiate the > > same ALPN, because the choice of http.Transport or http2.Transport is > > made only once and persists for the lifetime of the roundTripper. > > The lock protecting `roundTripper.initConn` is only held in `dialTLS`, > and the `roundTripper.transport` is not protected by a lock at all. > > If the target host changes and there is simultaneous access (two threads > call into `roundTripper.RoundTrip` right after initialization > simultaneously), there is no guarantee that the connection used to > create the inner `http.RoundTripper` instance will be passed to the > correct thread.
I see, you're right. It has to do with the reuse of the initConn. _______________________________________________ tor-dev mailing list tor-dev@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev