• Brad Fitzpatrick's avatar
    net/http: ignore 100-continue responses in Transport · a79df7bb
    Brad Fitzpatrick authored
    "There are only two hard problems in computer science:
    cache invalidation, naming things, and off-by-one errors."
    
    The HTTP server code already strips Expect: 100-continue on
    requests, so httputil.ReverseProxy should be unaffected, but
    some servers send unsolicited HTTP/1.1 100 Continue responses,
    so we need to skip over them if they're seen to avoid getting
    off-by-one on Transport requests/responses.
    
    This does change the behavior of people who were using Client
    or Transport directly and explicitly setting "Expect: 100-continue"
    themselves, but it didn't work before anyway. Now instead of the
    user code seeing a 100 response and then things blowing up, now
    it basically works, except the Transport will still blast away
    the full request body immediately.  That's the part that needs
    to be finished to close this issue.
    
    This is the safe quick fix.
    
    Update #3665
    
    R=golang-dev, dsymonds, dave, jgrahamc
    CC=golang-dev
    https://golang.org/cl/8166045
    a79df7bb
transport_test.go 40.3 KB