首页 > 解决方案 > 使用wsl-2 ubuntu时Gitlab api挂起

问题描述

在我的公司,我在https://gitlab.mycompany.com有一个 gitlab 。

在运行 Windows 10 的计算机上,我正在尝试使用 curl 使用 Gitlab api。

在dos终端中,它工作正常。

>curl -v https://gitlab.mycompany.com/api/v4/groups
*   Trying 10.57.36.28...
* TCP_NODELAY set
* Connected to gitlab.mycompany.com (10.57.36.28) port 443 (#0)
* schannel: SSL/TLS connection with gitlab.mycompany.com port 443 (step 1/3)
* schannel: checking server certificate revocation
* schannel: sending initial handshake data: sending 188 bytes...
* schannel: sent initial handshake data: sent 188 bytes
* schannel: SSL/TLS connection with gitlab.mycompany.com port 443 (step 2/3)
* schannel: failed to receive handshake, need more data
* schannel: SSL/TLS connection with gitlab.mycompany.com port 443 (step 2/3)
* schannel: encrypted data got 2097
* schannel: encrypted data buffer: offset 2097 length 4096
* schannel: sending next handshake data: sending 93 bytes...
* schannel: SSL/TLS connection with gitlab.mycompany.com port 443 (step 2/3)
* schannel: encrypted data got 274
* schannel: encrypted data buffer: offset 274 length 4096
* schannel: SSL/TLS handshake complete
* schannel: SSL/TLS connection with gitlab.mycompany.com port 443 (step 3/3)
* schannel: stored credential handle in session cache
> GET /api/v4/groups HTTP/1.1
> Host: gitlab.mycompany.com
> User-Agent: curl/7.55.1
> Accept: */*
...

现在我在 wsl2 ubuntu 20.04 终端中尝试相同的方法

>curl -v https://gitlab.mycompany.com/api/v4/groups
*   Trying 10.57.36.28:443...
* TCP_NODELAY set
* Connected to gitlab.mycompany.com (10.57.36.28) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):

... hangs for 1 or 2 minutes ...

* OpenSSL SSL_connect: Connection reset by peer in connection to gitlab.mycompany.com:443
* Closing connection 0
curl: (35) OpenSSL SSL_connect: Connection reset by peer in connection to gitlab.mycompany.com:443

我还尝试添加--insecure选项以确保但结果相同。

我在linux服务器上试过,它正在工作。

在我的 wsl2 ubuntu 终端中,我还尝试了其他 https 站点(内部和外部),它正在工作。

我不明白有什么问题。服务器似乎没有响应客户端握手。但为什么 ?

标签: ubuntucurlgitlabwsl-2

解决方案


推荐阅读