Redo http Transport code

* Insert User-Agent in Transport - fixes #199
  * Update timeouts to use Context
  * Modernise transport
This commit is contained in:
Nick Craig-Wood
2016-09-12 17:50:19 +01:00
parent 5c91623148
commit 0cb9bb3b54
15 changed files with 273 additions and 133 deletions
-2
View File
@@ -112,7 +112,6 @@ func (f *Fs) getCredentials() (err error) {
if err != nil {
return err
}
req.Header.Add("User-Agent", fs.UserAgent)
resp, err := f.client.Do(req)
if err != nil {
return err
@@ -155,7 +154,6 @@ func NewFs(name, root string) (fs.Fs, error) {
// Make the swift Connection
c := &swiftLib.Connection{
Auth: newAuth(f),
UserAgent: fs.UserAgent,
ConnectTimeout: 10 * fs.Config.ConnectTimeout, // Use the timeouts in the transport
Timeout: 10 * fs.Config.Timeout, // Use the timeouts in the transport
Transport: fs.Config.Transport(),