From 0ab2693da665479f8430a890b828617754b698e4 Mon Sep 17 00:00:00 2001 From: Xiaoxing Ye Date: Wed, 22 Jan 2020 00:34:29 +0800 Subject: [PATCH] doc: add desc about gzip and http dump Fix #3872 --- docs/content/docs.md | 9 ++++++++- fs/fshttp/http.go | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/content/docs.md b/docs/content/docs.md index 75f11c200..78aba9956 100644 --- a/docs/content/docs.md +++ b/docs/content/docs.md @@ -1378,7 +1378,14 @@ Write CPU profile to file. This can be analysed with `go tool pprof`. #### --dump flag,flag,flag #### The `--dump` flag takes a comma separated list of flags to dump info -about. These are: +about. + +Note that some headers including `Accept-Encoding` as shown may not +be correct in the request and the response may not show `Content-Encoding` +if the go standard libraries auto gzip encoding was in effect. In this case +the body of the request will be gunzipped before showing it. + +The available flags are: #### --dump headers #### diff --git a/fs/fshttp/http.go b/fs/fshttp/http.go index 1414426be..8caef8a4f 100644 --- a/fs/fshttp/http.go +++ b/fs/fshttp/http.go @@ -180,6 +180,13 @@ func NewTransportCustom(ci *fs.ConfigInfo, customize func(*http.Transport)) http t.IdleConnTimeout = 60 * time.Second t.ExpectContinueTimeout = ci.ExpectContinueTimeout + if ci.Dump&(fs.DumpHeaders|fs.DumpBodies|fs.DumpAuth|fs.DumpRequests|fs.DumpResponses) != 0 { + fs.Debugf(nil, "You have specified to dump information. Please be noted that the "+ + "Accept-Encoding as shown may not be correct in the request and the response may not show "+ + "Content-Encoding if the go standard libraries auto gzip encoding was in effect. In this case"+ + " the body of the request will be gunzipped before showing it.") + } + // customize the transport if required if customize != nil { customize(t)