Add insecure test Mode(#609)

Signed-off-by: Nan ZiYuan <quarkstar9@gmail.com>
This commit is contained in:
root 2020-02-26 12:52:20 +08:00
parent 9e63152573
commit 1d4e22d819
5 changed files with 6 additions and 6 deletions

View file

@ -107,7 +107,7 @@ func NewAppServiceQueryAPIHTTP(
) AppServiceQueryAPI {
if httpClient == nil {
customTransport := http.DefaultTransport.(*http.Transport).Clone()
if Cfg.Test.SkipSSLVerify == true {
if Cfg.Test.SkipSSLVerify {
customTransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
}
httpClient = &http.Client{

View file

@ -83,7 +83,7 @@ func SetupAppServiceAPIComponent(
},
Cfg: base.Cfg,
}
if base.Cfg.Test.SkipSSLVerify == true {
if base.Cfg.Test.SkipSSLVerify {
customTransport := http.DefaultTransport.(*http.Transport).Clone()
customTransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
appserviceQueryAPI.HTTPClient = &http.Client{

View file

@ -177,7 +177,7 @@ func (a *AppServiceQueryAPI) UserIDExists(
// makeHTTPClient creates an HTTP client with certain options that will be used for all query requests to application services
func makeHTTPClient(skipSSLVerify bool) *http.Client {
customTransport := http.DefaultTransport.(*http.Transport).Clone()
if skipSSLVerify == true {
if skipSSLVerify {
customTransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
}
return &http.Client{

View file

@ -227,7 +227,7 @@ func queryIDServerStoreInvite(
}
client := http.Client{}
if cfg.Test.SkipSSLVerify == true {
if cfg.Test.SkipSSLVerify {
customTransport := http.DefaultTransport.(*http.Transport).Clone()
customTransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
client = http.Client{

View file

@ -76,7 +76,7 @@ func CreateSession(
request.Header.Add("Content-Type", "application/x-www-form-urlencoded")
client := http.Client{}
if cfg.Test.SkipSSLVerify == true {
if cfg.Test.SkipSSLVerify {
customTransport := http.DefaultTransport.(*http.Transport).Clone()
customTransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
client = http.Client{
@ -171,7 +171,7 @@ func PublishAssociation(creds Credentials, userID string, cfg *config.Dendrite)
request.Header.Add("Content-Type", "application/x-www-form-urlencoded")
client := http.Client{}
if cfg.Test.SkipSSLVerify == true {
if cfg.Test.SkipSSLVerify {
customTransport := http.DefaultTransport.(*http.Transport).Clone()
customTransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
client = http.Client{