Files
quic-go/h2quic/response_writer_test.go
Lorenzo Saino 10acc677aa Make RoundTripper.RoundTrip(...) return if client timeout expires
Currently, the implementation of h2quic.RoundTripper.RoundTrip(req
*http.Request) ignores the context of req. As a result, if the
RoundTripper is used as transport of an http.Client with a timeout value
set, that is ignored.

For example, in the following snippet, client.Do(req) does not promptly
return if the task takes more than client.Timeout to complete.

    client := http.Client{
        Timeout: 50 * time.Millisecond,
        Transport = &h2quic.RoundTripper{}
    }
    req, err := http.NewRequest("GET", "https://www.example.com", nil)
    response, err := client.Do(req)

This commit updates h2quic.client.RoundTrip(req *http.Request) to return
an error if the request is cancelled.
2018-02-25 20:58:37 +00:00

5.1 KiB