proxy: send proxy version in user-agent header

This commit is contained in:
Jens Langhammer
2020-11-29 19:01:15 +01:00
parent 902953a2c7
commit 0a2c0464df
5 changed files with 47 additions and 32 deletions

View File

@ -3,6 +3,7 @@ package server
import (
"crypto/sha512"
"encoding/hex"
"fmt"
"math/rand"
"net/http"
"net/url"
@ -106,8 +107,7 @@ func getTLSTransport() http.RoundTripper {
// NewAPIController initialise new API Controller instance from URL and API token
func NewAPIController(pbURL url.URL, token string) *APIController {
transport := httptransport.New(pbURL.Host, client.DefaultBasePath, []string{pbURL.Scheme})
transport.Transport = getTLSTransport()
transport.Transport = SetUserAgent(getTLSTransport(), fmt.Sprintf("passbook-proxy@%s", pkg.VERSION))
// create the transport
auth := httptransport.BasicAuth("", token)