Commit dfe0840b authored by Faizal Aziz's avatar Faizal Aziz

adding retry ing connect to proxy

parent 9de08850
...@@ -3,7 +3,6 @@ package http_client ...@@ -3,7 +3,6 @@ package http_client
import ( import (
"bytes" "bytes"
"crypto/tls" "crypto/tls"
"encoding/base64"
"fmt" "fmt"
"github.com/go-resty/resty/v2" "github.com/go-resty/resty/v2"
"gitlab.ursabyte.com/faizal.aziz/ulfssar-go/pkg/context" "gitlab.ursabyte.com/faizal.aziz/ulfssar-go/pkg/context"
...@@ -117,9 +116,11 @@ func (c *client) GetWithProxyAuth(ctx *context.UlfsaarContext, path, ip, port, u ...@@ -117,9 +116,11 @@ func (c *client) GetWithProxyAuth(ctx *context.UlfsaarContext, path, ip, port, u
request.Header[h] = val request.Header[h] = val
} }
request.Header.Set(UserAgent, UserAgentValue) request.Header.Set(UserAgent, UserAgentValue)
request.Header.Set("Proxy-Authorization", base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", username, password))))
httpResp, httpErr := request.Get(urls) httpResp, httpErr := request.Get(urls)
for httpErr != nil {
time.Sleep(10 * time.Second)
httpResp, httpErr = request.Get(urls)
}
if httpResp != nil { if httpResp != nil {
body = httpResp.Body() body = httpResp.Body()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment