• Luan Santos's avatar
    net/http: allow reuse of http.Request objects · 78c4dc37
    Luan Santos authored
    Calling response.Body.Close() early would generarate a race before this.
    Since closing would return early before the main code path had a chance
    to reset the request canceler. Having a non-nil request canceler at the
    start of the next request would cause a "request canceled" error.
    
    Here we simply wait for the eofc channel to be closed before returning
    from earlyCloseFn, ensuring that the caller won't be re-using that
    Request object before we have a chance to reset the request canceler to
    nil.
    
    Fixes #21838
    
    Change-Id: I641815526c6ac63d1816c9b6ad49d73715f7a5cb
    Reviewed-on: https://go-review.googlesource.com/62891
    Run-TryBot: Tom Bergan <tombergan@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarTom Bergan <tombergan@google.com>
    78c4dc37
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...