chore: set User-Agent on all outgoing HTTP requests (#10867)
It's only polite, and it enables better troubleshooting in situations like weird-ass requests to the upgrades download service. --------- Signed-off-by: Jakob Borg <jakob@kastelo.net>
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/syncthing/syncthing/lib/build"
|
||||
"github.com/syncthing/syncthing/lib/osutil"
|
||||
"github.com/syncthing/syncthing/lib/rand"
|
||||
"github.com/syncthing/syncthing/lib/relay/protocol"
|
||||
@@ -53,6 +54,7 @@ func (c *dynamicClient) serve(ctx context.Context) error {
|
||||
l.Debugln(c, "failed to lookup dynamic relays", err)
|
||||
return err
|
||||
}
|
||||
req.Header.Set("User-Agent", build.UserAgent())
|
||||
data, err := http.DefaultClient.Do(req)
|
||||
if err != nil {
|
||||
l.Debugln(c, "failed to lookup dynamic relays", err)
|
||||
|
||||
Reference in New Issue
Block a user