我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

无法通过跳过证书从https获取xml

I've read here How to do a https request with bad certificate?, but also go give error:

tls: server's certificate contains an unsupported type of public key: *dsa.PublicKey

Here is my code:

tr := http.DefaultTransport.(*http.Transport)
    tr.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}

    client := &http.Client{Transport: tr}

    response, err := client.Get(httpsUrl)

    if err != nil {
        fmt.Println(err)
        return
    }

    defer response.Body.Close()
    body, _ := ioutil.ReadAll(response.Body)

    c.JSON(200, gin.H{"payload": body})

How to fix that?

近期文章

  • 如何在Go Present中的小节中添加文本?
  • 自定义构建的JSON模式无法正确验证
  • 在Windows机器上交叉编译linux相关代码
  • 如何在Go中打开/保存文件在另一台计算机上?
  • Golang的Delve找不到位于父文件夹中的软件包
  • 传递参数时如何在调试器中运行Go二进制文件?
  • Golang映射结构映射
  • 发布文件位置
  • 在带有嵌入式接口字段的Go中正确实现继承
  • 如何在go程序中消除对wpcap.dll的需要?
  • S3签名的URL失败
  • golang.org/x/sys/windows/registry(k键)ReadSubKeyNames()返回空片
  • 调用cgo宏函数
  • 微服务消息传递
  • Docker容器未找到所需的依赖项
  • 在Go中计算逆对数范数
  • 在安卓程序里 如何从EditText里获取插入的图片
  • 在Golang中获取数据库连接的连接字符串
  • 从Go脚本连续执行tshark
  • Redigo ScanStruct错误与time.Time

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华