mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-14 12:23:43 +00:00
fix: remove invalid characters in HTTP headers (#1053)
This commit is contained in:
2 files changed
+17
-2
No files matched your search
@@ -540,7 +540,7 @@ func (f *Fetcher) buildRequest(ctx context.Context, req *base.Request) (httpReq
|
||||
}
|
||||
if len(extra.Header) > 0 {
|
||||
for k, v := range extra.Header {
|
||||
headers.Set(k, v)
|
||||
headers.Set(k, strings.TrimSpace(v))
|
||||
}
|
||||
}
|
||||
if extra.Body != "" {
|
||||
@@ -548,7 +548,7 @@ func (f *Fetcher) buildRequest(ctx context.Context, req *base.Request) (httpReq
|
||||
}
|
||||
}
|
||||
if _, ok := headers[base.HttpHeaderUserAgent]; !ok {
|
||||
headers.Set(base.HttpHeaderUserAgent, f.config.UserAgent)
|
||||
headers.Set(base.HttpHeaderUserAgent, strings.TrimSpace(f.config.UserAgent))
|
||||
}
|
||||
|
||||
if ctx != nil {
|
||||
|
||||
Reference in new issue
Block a user