aliyun / darabonba-openapi

15 stars 8 forks source link

green-20220302 tls: failed to find any PEM data in certificate input #131

Closed loyipsing closed 1 year ago

loyipsing commented 1 year ago

官方文档地址:https://help.aliyun.com/document_detail/433945.html

alibabacloud-go/darabonba-openapi/v2@v2.0.3/client/client.go :1236

_runtime := map[string]interface{}{ "timeouted": "retry", "key": tea.StringValue(util.DefaultString(runtime.Key, client.Key)), "cert": tea.StringValue(util.DefaultString(runtime.Cert, client.Cert)), "ca": tea.StringValue(util.DefaultString(runtime.Ca, client.Ca)), "readTimeout": tea.IntValue(util.DefaultNumber(runtime.ReadTimeout, client.ReadTimeout)), "connectTimeout": tea.IntValue(util.DefaultNumber(runtime.ConnectTimeout, client.ConnectTimeout)), "httpProxy": tea.StringValue(util.DefaultString(runtime.HttpProxy, client.HttpProxy)), "httpsProxy": tea.StringValue(util.DefaultString(runtime.HttpsProxy, client.HttpsProxy)), "noProxy": tea.StringValue(util.DefaultString(runtime.NoProxy, client.NoProxy)), "socks5Proxy": tea.StringValue(util.DefaultString(runtime.Socks5Proxy, client.Socks5Proxy)), "socks5NetWork": tea.StringValue(util.DefaultString(runtime.Socks5NetWork, client.Socks5NetWork)), "maxIdleConns": tea.IntValue(util.DefaultNumber(runtime.MaxIdleConns, client.MaxIdleConns)), "retry": map[string]interface{}{ "retryable": tea.BoolValue(runtime.Autoretry), "maxAttempts": tea.IntValue(util.DefaultNumber(runtime.MaxAttempts, tea.Int(3))), }, "backoff": map[string]interface{}{ "policy": tea.StringValue(util.DefaultString(runtime.BackoffPolicy, tea.String("no"))), "period": tea.IntValue(util.DefaultNumber(runtime.BackoffPeriod, tea.Int(1))), }, "ignoreSSL": tea.BoolValue(runtime.IgnoreSSL), }

1、这里会把runtime中为nil的参数,转为空字符串

2、在 :alibabacloud-go/tea@v1.1.20/tea/tea.go :305 把 空字符串 赋值回 RuntimeObject

3、在 alibabacloud-go/tea@v1.1.20/tea/tea.go :351getHttpTransport(request, runtimeObject) -> alibabacloud-go/tea@v1.1.20/tea/tea.go :416 判断是否为 nil(已经被第二步直接赋值为空字符串,恒为true)

导致tls读取证书错误

loyipsing commented 1 year ago

暂时解决办法:

config.SetProtocol("http")

强制使用http协议

yndu13 commented 1 year ago

已解决,感谢反馈。请更新此库的版本。