duancashi1362 2019-05-18 06:18
浏览 93
已采纳

为什么“ http.Get()”方法会引发致命异常?

I am trying to use the following method:

response,err:=http.Get("https://support.microsoft.com")

It is working as expected. But when I call it with "https://samsung.com", it is throwing fatal exception that I can not handle.

A code sample:

package main

import (
    "fmt"
    "net/http"
)

func main() {
    _, err := http.Get("http://support.microsoft.com")
    if err != nil {
        fmt.Println(err)
    }
}  

and here is the error:

panic: cipher.NewCBCEncrypter: IV length must equal block size
goroutine 55 [running]:
crypto/cipher.NewCBCEncrypter(0x7c7680, 0xc0001cd0b0, 0xc0000c03c8, 0x10, 0x20, 0x0, 0x0)
C:/Go/src/crypto/cipher/cbc.go:47 +0x139  
crypto/tls.cipherAES(0xc0000c0388, 0x20, 0x60, 0xc0000c03c8, 0x10, 0x20, 0x0, 0x20, 0xc00008c156)  
C:/Go/src/crypto/tls/cipher_suites.go:139 +0xe2  
crypto/tls.(*clientHandshakeState).establishKeys(0xc0001dfdc8, 0x0, 0x0)  
C:/Go/src/crypto/tls/handshake_client.go:625 +0x20c  
crypto/tls.(*clientHandshakeState).handshake(0xc0001dfdc8, 0xc0000b7200, 0x0)  
C:/Go/src/crypto/tls/handshake_client.go:402 +0x426  
crypto/tls.(*Conn).clientHandshake(0xc00003dc00, 0x0, 0x0)  
C:/Go/src/crypto/tls/handshake_client.go:208 +0x2d4  
crypto/tls.(*Conn).Handshake(0xc00003dc00, 0x0, 0x0)  
C:/Go/src/crypto/tls/conn.go:1343 +0xf6  
net/http.(*persistConn).addTLS.func2(0x0, 0xc00003dc00, 0xc0000cc7d0, 0xc000093da0)  
C:/Go/src/net/http/transport.go:1190 +0x49  
created by net/http.(*persistConn).addTLS  
C:/Go/src/net/http/transport.go:1186 +0x1b2  
  • 写回答

1条回答 默认 最新

  • dtlygweb2017 2019-05-18 08:44
    关注

    i just fixed my problem by updating go from 1.12.4 to 1.12.5.
    thanks to @Markus-W-Mahlberg

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事:
  • ¥15 前置放大电路与功率放大电路相连放大倍数出现问题
  • ¥30 关于<main>标签页面跳转的问题
  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系
  • ¥30 VMware 云桌面水印如何添加
  • ¥15 用ns3仿真出5G核心网网元
  • ¥15 matlab答疑 关于海上风电的爬坡事件检测
  • ¥88 python部署量化回测异常问题