net/http: fix a data race when Request.Cancel is used
net/http: fix a data race when Request.Cancel is used

The "add a Request.Cancel channel" change (https://golang.org/cl/11601)
added support for "race free" cancellation, but introduced a data race. :)

Noticed while running "go test -race net/http". The test is skipped in
short mode, so we never saw it on the dashboard.

Change-Id: Ica14579d8723f8f9d1691e8d56c30b585b332c64
Reviewed-on: https://go-review.googlesource.com/12663
Reviewed-by: Aaron Jacobs <68841e62bd2061843a4f4a0261e80b673d56389c@google.com>
Reviewed-by: Brad Fitzpatrick <ae9783c0b0efc69cd85ab025ddd17aa44cdc4aa5@golang.org>
Run-TryBot: Brad Fitzpatrick <ae9783c0b0efc69cd85ab025ddd17aa44cdc4aa5@golang.org>
TryBot-Result: Gobot Gobot <66cb808b70d30c07676d5e946fee83fd561249e5@golang.org>

mgyenik/go,wangfakang/go-1,dpatel06/go,theif519/go,Cofyc/go,vsekhar/elastic-go,gohin/go,alex-zhang/go,gdey/go,Young55555/go,CiscoCloud/go,skatsuta/go,mwhudson/go,XuYunnan/go,xujianhai/go,Young55555/go,theif519/go,Endika/go,constantine001/go,devpadawan/go,goodlang/good,albertjin/golang-go,Young55555/go,kakuhiroshi/go,cookerzhu/go,JioCloud/go,b54898533/go,miolini/go,jasonxiong/go,mikekap/go,vsdutka/go,mdp/go,shines77/go,josharian/go,ImJasonH/go,linux-on-ibm-z/go,cloudrain21/go,NunoEdgarGub1/go,kim-racktop/go,jonahglover/go,deft-code/go,momchil-velikov/go,ImJasonH/go,sinuos/go,mdp/go,jonathanmarvens/go,Endika/go,arschles/go-1,XuYunnan/go,ichu501/go,odeke-em/go,wangfakang/go-1,springning/go,vsdutka/go,nawawi/go,Charlesdong/go-1,rachtsingh/gogojuice,gdey/go,xiuzhifu/go,skotti/go,skotti/go,fjballest/golang,deft-code/go,youprofit/go,NichoZhang/go,Charlesdong/go-1,yasarkunduz/go,jonasi/go,springning/go,devpadawan/go,snowsnail/go,slavau/go,kakuhiroshi/go,yuhengye/go,jacobhaven/go,dafyddcrosby/go,constantine001/go,NunoEdgarGub1/go,alex-zhang/go,arschles/golang-go,vsekhar/elastic-go,sosop/go,kakuhiroshi/go,derekmarcotte/go,WIZARD-CXY/go,samanalysis/go,shines77/go,ifagnosticism/go,binarycrusader/go,myPublicGit/go,fjballest/golang,linux-on-ibm-z/go,GeorgiCodes/go,sinuos/go,4ad/go,mwhudson/go,golang/go,undergrowthlinear/go,ericsnowcurrently/go,rentongzhang/go,famorted/go,monetate/go,ericsnowcurrently/go,ImJasonH/go,rentongzhang/go,zcwfeng/go,gdey/go,cookerzhu/go,chinanjjohn2012/go,vishsingh/go,sosop/go,malvira/go,jefby/go,mbrukman/go,Badredapple/go,theass/go,leeric92/go,cloudrain21/go,CarterTsai/go,sinuos/go,myPublicGit/go,shazow/go,CiscoCloud/go,jdeng/go,suncycheng/go,baiyunping333/go,ichu501/go,greyhwndz/go,goodlang/good,stormltf/go,sndnvaps/go,kakuhiroshi/go,Pulgafree/go,Charlesdong/go-1,jdhenke/go,binarycrusader/go,famorted/go,jacobsa/go,jacobsa/go,alash3al/go,fjballest/golang,famorted/go,chinanjjohn2012/go,AALEKH/go,joshsammut/go,shines77/go,wangfakang/go-1,lihuanghai/go,greyhwndz/go,myPublicGit/go,CodyGuo/go,shazow/go,skatsuta/go,cyberroadie/go,codestation/go,mbrukman/go,jefby/go,cloudflare/go,NunoEdgarGub1/go,ericsnowcurrently/go,yangzhongj/go,sosop/go,Stan-Lin-/go,NunoEdgarGub1/go,codestation/go,CAFxX/go,kakuhiroshi/go,binarycrusader/go,likesea/go,samanalysis/go,roth1002/go,jasonxiong/go,odeke-em/go,albertjin/golang-go,nakedgc/go,willjunspecial/go,cloudflare/go,monetate/go,polyverse-security/go,jdeng/go,fjballest/golang,jasonxiong/go,kevinc0825/go,samanalysis/go,uileyar/go,rachtsingh/gogojuice,arschles/golang-go,famorted/go,mdp/go,greyhwndz/go,slavau/go,likesea/go,andrewchambers/go,jacobsa/go,jdhenke/go,jdhenke/go,4ad/go,deft-code/go,kakuhiroshi/go,jameskumar/go,xujianhai/go,cainiaocome/go,albertjin/golang-go,Endika/go,albertjin/golang-go,kevinc0825/go,xiuzhifu/go,jacobhaven/go,b54898533/go,honsiorovskyi/go,ganboing/go-esx,Charlesdong/go-1,theif519/go,qskycolor/go,zhangg/go,yasarkunduz/go,vanloswang/go,cloudflare/go,mbrukman/go,andrewchambers/go,likesea/go,dafyddcrosby/go,ObjectiveJoe/go,danielsoro/go,xiaobodu/go,danielsoro/go,Jordanzuo/go,jdeng/go,monetate/go,ObjectiveJoe/go,arschles/go-1,miolini/go,arschles/go-1,jonathanmarvens/go,goodlang/good,xiuzhifu/go,mikekap/go,cloudrain21/go,alash3al/go,cainiaocome/go,vsekhar/elastic-go,willjunspecial/go,vsdutka/go,NunoEdgarGub1/go,roth1002/go,vsekhar/elastic-go,likesea/go,g522342435/go,likesea/go,rentongzhang/go,NichoZhang/go,dpatel06/go,vanloswang/go,gdey/go,nakedgc/go,constantine001/go,sndnvaps/go,odeke-em/go,ErikDubbelboer/go,qskycolor/go,theif519/go,Young55555/go,ichu501/go,binarycrusader/go,JioCloud/go,Badredapple/go,theif519/go,zcwfeng/go,shines77/go,goodlang/good,lihuanghai/go,akutz/go,JioCloud/go,baiyunping333/go,chinanjjohn2012/go,zouchao2010/go,dterei/go,sndnvaps/go,mdp/go,AALEKH/go,cainiaocome/go,GeorgiCodes/go,jmptrader/go,jacobsa/go,parkdy/go,baiyunping333/go,ichu501/go,Pulgafree/go,jameskumar/go,Samurais/go,miolini/go,beealone/go,CiscoCloud/go,jacobxk/go,theass/go,willjunspecial/go,mdp/go,odeke-em/go,zouchao2010/go,malvira/go,mikekap/go,deft-code/go,leeric92/go,undergrowthlinear/go,b54898533/go,gohin/go,cainiaocome/go,jameskumar/go,binarycrusader/go,NunoEdgarGub1/go,4ad/go,honsiorovskyi/go,JioCloud/go,Pulgafree/go,youprofit/go,xujianhai/go,chinanjjohn2012/go,CAFxX/go,Jordanzuo/go,nakedgc/go,Stan-Lin-/go,skatsuta/go,cloudflare/go,andrewchambers/go,deft-code/go,yasarkunduz/go,miolini/go,GeorgiCodes/go,rentongzhang/go,jacobhaven/go,snowsnail/go,joshsammut/go,arschles/go-1,xinhuang327/go,dterei/go,cainiaocome/go,malvira/go,alash3al/go,leeric92/go,fjballest/golang,Pulgafree/go,zhangg/go,CodyGuo/go,kevinc0825/go,CarterTsai/go,andrewchambers/go,jacobhaven/go,golang/go,binarycrusader/go,4ad/go,sinuos/go,shazow/go,Samurais/go,JioCloud/go,kevinc0825/go,momchil-velikov/go,sndnvaps/go,mdp/go,CAFxX/go,binarycrusader/go,NichoZhang/go,springning/go,jacobhaven/go,myPublicGit/go,xinhuang327/go,rachtsingh/gogojuice,alex-zhang/go,ifagnosticism/go,NichoZhang/go,wangfakang/go-1,beealone/go,mgyenik/go,jameskumar/go,jonasi/go,honsiorovskyi/go,vsekhar/elastic-go,nawawi/go,jonahglover/go,monetate/go,nakedgc/go,xiaobodu/go,malvira/go,gohin/go,Stan-Lin-/go,roth1002/go,ObjectiveJoe/go,linux-on-ibm-z/go,wangfakang/go-1,dpatel06/go,momchil-velikov/go,Badredapple/go,odeke-em/go,zhangg/go,Cofyc/go,dterei/go,mgyenik/go,odeke-em/go,gdey/go,mbrukman/go,alex-zhang/go,kevinc0825/go,alex-zhang/go,ifagnosticism/go,dafyddcrosby/go,shazow/go,snowsnail/go,parkdy/go,donnel6809/go,akutz/go,jdhenke/go,cloudrain21/go,josharian/go,sosop/go,fjballest/golang,vishsingh/go,alash3al/go,lihuanghai/go,vishsingh/go,nawawi/go,alex-zhang/go,akutz/go,derekmarcotte/go,cloudflare/go,jmptrader/go,arschles/golang-go,arschles/golang-go,dpatel06/go,suncycheng/go,chinanjjohn2012/go,ErikDubbelboer/go,yangzhongj/go,cloudflare/go,jasonxiong/go,honsiorovskyi/go,leeric92/go,odeke-em/go,derekmarcotte/go,jasonxiong/go,devpadawan/go,linux-on-ibm-z/go,beealone/go,jacobhaven/go,stormltf/go,yuhengye/go,joshsammut/go,jonathanmarvens/go,springning/go,jonahglover/go,jonathanmarvens/go,uileyar/go,WIZARD-CXY/go,xinhuang327/go,gdey/go,suncycheng/go,baiyunping333/go,ImJasonH/go,jacobxk/go,akutz/go,Cofyc/go,AALEKH/go,g522342435/go,arschles/golang-go,polyverse-security/go,jefby/go,odeke-em/go,samanalysis/go,goodlang/good,jacobhaven/go,nakedgc/go,suncycheng/go,golang/go,mwhudson/go,theass/go,AALEKH/go,ganboing/go-esx,derekmarcotte/go,xujianhai/go,mbrukman/go,qskycolor/go,youprofit/go,CAFxX/go,Samurais/go,springning/go,mgyenik/go,joshsammut/go,ErikDubbelboer/go,jmptrader/go,mgyenik/go,ErikDubbelboer/go,cloudrain21/go,arschles/go-1,rachtsingh/gogojuice,yasarkunduz/go,andrewchambers/go,danycoro/go,devpadawan/go,arschles/go-1,beealone/go,alash3al/go,goodlang/good,Badredapple/go,josharian/go,xujianhai/go,Endika/go,GeorgiCodes/go,GeorgiCodes/go,monetate/go,sndnvaps/go,stormltf/go,deft-code/go,chinanjjohn2012/go,CiscoCloud/go,snowsnail/go,snowsnail/go,polyverse-security/go,dterei/go,myPublicGit/go,jacobxk/go,gohin/go,b54898533/go,rachtsingh/gogojuice,ifagnosticism/go,zhangg/go,roth1002/go,akutz/go,likesea/go,rachtsingh/gogojuice,malvira/go,Pulgafree/go,xujianhai/go,danycoro/go,danielsoro/go,dafyddcrosby/go,qskycolor/go,ichu501/go,Samurais/go,cyberroadie/go,deft-code/go,Cofyc/go,Badredapple/go,xiaobodu/go,vanloswang/go,CarterTsai/go,undergrowthlinear/go,jasonxiong/go,kim-racktop/go,zouchao2010/go,g522342435/go,donnel6809/go,JioCloud/go,constantine001/go,skatsuta/go,lihuanghai/go,rentongzhang/go,jacobxk/go,WIZARD-CXY/go,AALEKH/go,undergrowthlinear/go,beealone/go,ifagnosticism/go,youprofit/go,linux-on-ibm-z/go,undergrowthlinear/go,myPublicGit/go,snowsnail/go,qskycolor/go,kim-racktop/go,jonathanmarvens/go,slavau/go,jacobxk/go,nawawi/go,miolini/go,donnel6809/go,JioCloud/go,danielsoro/go,danycoro/go,skotti/go,Badredapple/go,yangzhongj/go,greyhwndz/go,cyberroadie/go,CarterTsai/go,danycoro/go,xinhuang327/go,XuYunnan/go,zcwfeng/go,slavau/go,willjunspecial/go,rentongzhang/go,golang/go,Samurais/go,yangzhongj/go,willjunspecial/go,jmptrader/go,jefby/go,skotti/go,shazow/go,mbrukman/go,yangzhongj/go,zcwfeng/go,yuhengye/go,lihuanghai/go,derekmarcotte/go,dterei/go,AALEKH/go,alash3al/go,cloudrain21/go,skatsuta/go,famorted/go,4ad/go,shazow/go,cloudflare/go,CAFxX/go,vsekhar/elastic-go,fjballest/golang,sndnvaps/go,theif519/go,constantine001/go,vsdutka/go,yasarkunduz/go,cainiaocome/go,slavau/go,stormltf/go,snowsnail/go,donnel6809/go,theass/go,deft-code/go,Charlesdong/go-1,cyberroadie/go,vanloswang/go,cyberroadie/go,rentongzhang/go,stormltf/go,jameskumar/go,cookerzhu/go,josharian/go,youprofit/go,parkdy/go,skotti/go,Jordanzuo/go,dterei/go,constantine001/go,mbrukman/go,roth1002/go,rentongzhang/go,samanalysis/go,shazow/go,CarterTsai/go,andrewchambers/go,youprofit/go,sosop/go,xiuzhifu/go,jefby/go,slavau/go,malvira/go,leeric92/go,jmptrader/go,jacobxk/go,sinuos/go,ichu501/go,Pulgafree/go,danycoro/go,xiuzhifu/go,yasarkunduz/go,danielsoro/go,cookerzhu/go,ImJasonH/go,famorted/go,Young55555/go,xiuzhifu/go,greyhwndz/go,josharian/go,vishsingh/go,gdey/go,zhangg/go,kim-racktop/go,jdeng/go,Stan-Lin-/go,ericsnowcurrently/go,qskycolor/go,Badredapple/go,sosop/go,WIZARD-CXY/go,jonahglover/go,mbrukman/go,joshsammut/go,binarycrusader/go,WIZARD-CXY/go,Stan-Lin-/go,parkdy/go,roth1002/go,zouchao2010/go,xinhuang327/go,WIZARD-CXY/go,cyberroadie/go,cainiaocome/go,kevinc0825/go,dafyddcrosby/go,ImJasonH/go,malvira/go,springning/go,jdeng/go,mwhudson/go,goodlang/good,jonasi/go,polyverse-security/go,christopher-henderson/Go,lihuanghai/go,roth1002/go,gohin/go,vsdutka/go,jacobhaven/go,shines77/go,gohin/go,mdp/go,wangfakang/go-1,Samurais/go,danycoro/go,fjballest/golang,malvira/go,CiscoCloud/go,ImJasonH/go,gohin/go,devpadawan/go,nawawi/go,jonahglover/go,g522342435/go,youprofit/go,honsiorovskyi/go,Stan-Lin-/go,danielsoro/go,stormltf/go,cloudrain21/go,dafyddcrosby/go,golang/go,jameskumar/go,AALEKH/go,jacobsa/go,xiaobodu/go,Endika/go,akutz/go,vishsingh/go,XuYunnan/go,cookerzhu/go,danielsoro/go,arschles/golang-go,kakuhiroshi/go,Young55555/go,Jordanzuo/go,honsiorovskyi/go,undergrowthlinear/go,miolini/go,codestation/go,qskycolor/go,jdeng/go,uileyar/go,alash3al/go,CiscoCloud/go,suncycheng/go,vsdutka/go,codestation/go,rachtsingh/gogojuice,jmptrader/go,shines77/go,yuhengye/go,momchil-velikov/go,leeric92/go,akutz/go,derekmarcotte/go,zouchao2010/go,Cofyc/go,likesea/go,albertjin/golang-go,Endika/go,cookerzhu/go,skatsuta/go,golang/go,sndnvaps/go,ganboing/go-esx,ganboing/go-esx,mwhudson/go,g522342435/go,yasarkunduz/go,springning/go,jdeng/go,beealone/go,xiuzhifu/go,jonasi/go,skotti/go,zcwfeng/go,codestation/go,shines77/go,dafyddcrosby/go,yuhengye/go,monetate/go,vanloswang/go,linux-on-ibm-z/go,jefby/go,theass/go,ganboing/go-esx,CarterTsai/go,jdhenke/go,mikekap/go,linux-on-ibm-z/go,willjunspecial/go,momchil-velikov/go,mgyenik/go,cookerzhu/go,roth1002/go,cyberroadie/go,Jordanzuo/go,g522342435/go,leeric92/go,vsekhar/elastic-go,momchil-velikov/go,mikekap/go,monetate/go,cookerzhu/go,zcwfeng/go,xinhuang327/go,vishsingh/go,snowsnail/go,uileyar/go,arschles/go-1,GeorgiCodes/go,myPublicGit/go,jdeng/go,jdhenke/go,vsdutka/go,yuhengye/go,b54898533/go,xiaobodu/go,Cofyc/go,danycoro/go,yangzhongj/go,Charlesdong/go-1,mikekap/go,dterei/go,kevinc0825/go,skotti/go,CAFxX/go,suncycheng/go,kakuhiroshi/go,Endika/go,monetate/go,ifagnosticism/go,joshsammut/go,jonahglover/go,ifagnosticism/go,jacobsa/go,alex-zhang/go,dafyddcrosby/go,vanloswang/go,yuhengye/go,cainiaocome/go,jacobsa/go,zouchao2010/go,parkdy/go,ifagnosticism/go,kim-racktop/go,uileyar/go,NichoZhang/go,4ad/go,baiyunping333/go,NunoEdgarGub1/go,zhangg/go,jdhenke/go,nakedgc/go,parkdy/go,codestation/go,alex-zhang/go,NichoZhang/go,xiuzhifu/go,kim-racktop/go,Young55555/go,lihuanghai/go,ErikDubbelboer/go,ericsnowcurrently/go,polyverse-security/go,Pulgafree/go,CiscoCloud/go,stormltf/go,CodyGuo/go,wangfakang/go-1,jasonxiong/go,polyverse-security/go,youprofit/go,xinhuang327/go,ganboing/go-esx,codestation/go,ganboing/go-esx,devpadawan/go,4ad/go,baiyunping333/go,yangzhongj/go,Jordanzuo/go,ichu501/go,XuYunnan/go,ObjectiveJoe/go,ImJasonH/go,ErikDubbelboer/go,vsekhar/elastic-go,sinuos/go,momchil-velikov/go,gdey/go,polyverse-security/go,golang/go,shines77/go,vanloswang/go,CodyGuo/go,CodyGuo/go,ericsnowcurrently/go,Young55555/go,theif519/go,Samurais/go,CodyGuo/go,NichoZhang/go,WIZARD-CXY/go,Endika/go,theif519/go,samanalysis/go,donnel6809/go,vsdutka/go,mgyenik/go,xiaobodu/go,Samurais/go,ObjectiveJoe/go,miolini/go,xiaobodu/go,kevinc0825/go,willjunspecial/go,likesea/go,XuYunnan/go,derekmarcotte/go,jonasi/go,xujianhai/go,mgyenik/go,undergrowthlinear/go,jdhenke/go,jameskumar/go,willjunspecial/go,vishsingh/go,jonasi/go,jonahglover/go,NunoEdgarGub1/go,donnel6809/go,Charlesdong/go-1,jmptrader/go,gohin/go,ErikDubbelboer/go,myPublicGit/go,vanloswang/go,famorted/go,Jordanzuo/go,jonasi/go,sosop/go,greyhwndz/go,g522342435/go,CAFxX/go,ganboing/go-esx,devpadawan/go,CarterTsai/go,shazow/go,albertjin/golang-go,Badredapple/go,kim-racktop/go,ErikDubbelboer/go,Cofyc/go,CodyGuo/go,XuYunnan/go,WIZARD-CXY/go,yuhengye/go,greyhwndz/go,mwhudson/go,josharian/go,chinanjjohn2012/go,XuYunnan/go,cloudflare/go,constantine001/go,Stan-Lin-/go,suncycheng/go,honsiorovskyi/go,skotti/go,albertjin/golang-go,dpatel06/go,ericsnowcurrently/go,jacobxk/go,suncycheng/go,theass/go,g522342435/go,sinuos/go,ObjectiveJoe/go,jonathanmarvens/go,skatsuta/go,ObjectiveJoe/go,joshsammut/go,4ad/go,slavau/go,b54898533/go,mikekap/go,goodlang/good,devpadawan/go,GeorgiCodes/go,Charlesdong/go-1,jacobsa/go,mwhudson/go,dpatel06/go,ObjectiveJoe/go,arschles/golang-go,polyverse-security/go,Stan-Lin-/go,beealone/go,stormltf/go,codestation/go,nawawi/go,slavau/go,jefby/go,sinuos/go,derekmarcotte/go,jasonxiong/go,danielsoro/go,sosop/go,AALEKH/go,Cofyc/go,CarterTsai/go,arschles/golang-go,jonasi/go,zcwfeng/go,uileyar/go,alash3al/go,CAFxX/go,donnel6809/go,mikekap/go,nawawi/go,dpatel06/go,albertjin/golang-go,donnel6809/go,andrewchambers/go,vishsingh/go,leeric92/go,b54898533/go,nawawi/go,baiyunping333/go,samanalysis/go,dpatel06/go,dterei/go,constantine001/go,jameskumar/go,jmptrader/go,baiyunping333/go,greyhwndz/go,CodyGuo/go,joshsammut/go,theass/go,jonahglover/go,josharian/go,samanalysis/go,ichu501/go,golang/go,cloudrain21/go,Pulgafree/go,nakedgc/go,nakedgc/go,famorted/go,linux-on-ibm-z/go,momchil-velikov/go,CiscoCloud/go,ericsnowcurrently/go,cyberroadie/go,sndnvaps/go,zouchao2010/go,Jordanzuo/go,jacobxk/go,yasarkunduz/go,parkdy/go,arschles/go-1,beealone/go,uileyar/go,springning/go,GeorgiCodes/go,zhangg/go,jonathanmarvens/go,danycoro/go,kim-racktop/go,b54898533/go,honsiorovskyi/go,andrewchambers/go,chinanjjohn2012/go,akutz/go,miolini/go,xiaobodu/go,xinhuang327/go,rachtsingh/gogojuice,skatsuta/go,JioCloud/go,zcwfeng/go,theass/go,wangfakang/go-1,jefby/go,xujianhai/go,parkdy/go,NichoZhang/go,josharian/go,lihuanghai/go,zhangg/go,mdp/go,undergrowthlinear/go,jonathanmarvens/go,mwhudson/go,uileyar/go,zouchao2010/go,qskycolor/go,yangzhongj/go