Skip to content

Commit

Permalink
Hide DoH client http header "User-Agent", fix #446 (#518)
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterDaveHello authored May 17, 2022
1 parent 688dae8 commit 4690ed8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion resolver/upstream_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,15 @@ func (r *httpUpstreamClient) callExternal(msg *dns.Msg,
return nil, 0, fmt.Errorf("can't pack message: %w", err)
}

httpResponse, err := r.client.Post(upstreamURL, dnsContentType, bytes.NewReader(rawDNSMessage))
req, err := http.NewRequest("POST", upstreamURL, bytes.NewReader(rawDNSMessage))

if err != nil {
return nil, 0, fmt.Errorf("can't create the new request %w", err)
}

req.Header.Set("User-Agent", "")
req.Header.Set("Content-Type", dnsContentType)
httpResponse, err := r.client.Do(req)

if err != nil {
return nil, 0, fmt.Errorf("can't perform https request: %w", err)
Expand Down

0 comments on commit 4690ed8

Please sign in to comment.