rclone/lib/rest
Nick Craig-Wood 2e2451f8ec lib/rest: fix problems re-using HTTP connections
Before this fix, it was noticed that the rclone webdav client did not
re-use HTTP connections when it should have been.

This turned out to be because rclone was not draining the HTTP bodies
when it was not expecting a response.

From the Go docs:

> If the returned error is nil, the Response will contain a non-nil
> Body which the user is expected to close. If the Body is not both
> read to EOF and closed, the Client's underlying RoundTripper
> (typically Transport) may not be able to re-use a persistent TCP
> connection to the server for a subsequent "keep-alive" request.

This fixes the problem by draining up to 10MB of data from an HTTP
response if the NoResponse flag is set, or at the end of a JSON or XML
response (which could have some whitespace on the end).

See: https://forum.rclone.org/t/webdav-with-persistent-connections/37024/
2023-03-26 17:19:48 +01:00
..
headers.go backend/http: support content-range response header 2022-11-08 13:04:17 +00:00
headers_test.go backend/http: support content-range response header 2022-11-08 13:04:17 +00:00
rest.go lib/rest: fix problems re-using HTTP connections 2023-03-26 17:19:48 +01:00
url.go Error strings should not be capitalized 2022-06-23 23:26:02 +02:00
url_test.go build: more pre go1.8 workarounds removed 2019-05-08 15:14:51 +01:00