• Joe Lee's avatar
    Make HttpClient adapter preserve exception behavior · ea4dc7f0
    Joe Lee authored
    Ideally, the HttpClient/HttpServer adapters should maintain the invariant that
    the behavior of a given client is the same as the behavior of
    newHttpClient(newHttpService(client)).  Prior to this change, the HttpClient
    wrapper lazily called request(), so a client whose request() eagerly threw an
    exception could produce a different exception when called directly versus when
    wrapped -- the laziness allowed additional code to run.  This was particularly
    evident when making a request with a body, since code using a wrapped client
    would be able to set up a subsequent BlockedWrite, eventually resulting in a
    "read end of pipe was aborted" exception instead of the actual exception.
    
    This change makes HttpClientAdapter::request() execute the wrapped request()
    eagerly.
    
    (Note that it partially undoes 90d48343... Hopefully, it preserves the desired
    behavior added there.)
    ea4dc7f0
http.c++ 181 KB