【问题标题】:curl: why do I get empty response?curl:为什么我得到空响应?
【发布时间】:2025-12-07 17:05:01
【问题描述】:

我使用谷歌开发者工具并将答案复制为 curl 请求

当我在我的 linux 服务器上运行 curl 时,我收到 来自服务器的空回复

curl 'https://web-ast.dsi.cnrs.fr/l3c/owa/personnel.liste?nom=&prenom=&code_labo=&p_dep=52&sec=&bap=&emptype=&nat_pers=&typ_pers=&organisme=&delegation=&ville=&p_i=0&p_nb_res=0' \
-H 'Accept-Encoding: gzip, deflate, sdch, br' -H 'Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4,es;q=0.2,pl;q=0.2' \
-H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36' \
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' \
-H 'Cache-Control: max-age=0' -H 'Connection: keep-alive' \
--compressed

curl: (52) Empty reply from server

详细输出:

* Hostname was NOT found in DNS cache
*   Trying 193.52.36.99...
* Connected to web-ast.dsi.cnrs.fr (193.52.36.99) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using AES256-SHA
* Server certificate:
*    subject: OU=Domain Control Validated; CN=web-ast.dsi.cnrs.fr
*    start date: 2013-10-21 00:00:00 GMT
*    expire date: 2016-10-20 23:59:59 GMT
*    subjectAltName: web-ast.dsi.cnrs.fr matched
*    issuer: C=NL; O=TERENA; CN=TERENA SSL CA
*    SSL certificate verify ok.
> GET /l3c/owa/personnel.liste?nom=&prenom=&code_labo=&p_dep=52&sec=&bap=&emptype=&nat_pers=&typ_pers=&organisme=&delegation=&ville=&p_i=0&p_nb_res=0 HTTP/1.1
> Host: web-ast.dsi.cnrs.fr
> Accept-Encoding: gzip, deflate, sdch, br
> Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4,es;q=0.2,pl;q=0.2
> Upgrade-Insecure-Requests: 1
> User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36
> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
> Cache-Control: max-age=0
> Connection: keep-alive
> 
* SSLv3, TLS alert, Client hello (1):
* Empty reply from server
* Connection #0 to host web-ast.dsi.cnrs.fr left intact
curl: (52) Empty reply from server

知道为什么吗?

【问题讨论】:

  • 嗨 Yarek,我添加了请求的详细输出,我遇到了同样的问题。您使用的是什么操作系统和 OpenSSL 版本?我在使用 OpenSSL 1.0.1f 的 Mint 17.2 (Ubuntu 14.04)。我想知道这是否相关。很快就会尝试 RHEL 和其他一些 OpenSSL 版本。我什至尝试了openssl s_client -connect web-ast.dsi.cnrs.fr:443,无论我发送什么(虚假数据或有效的 HTTP 请求),连接都会关闭而不发回任何数据。 wget 遇到同样的问题,所以它与 curl 无关,很可能是 OpenSSL。

标签: ssl curl


【解决方案1】:

-k, --insecure (SSL) 此选项明确允许 curl 执行“不安全”的 SSL 连接和传输。尝试使用默认安装的 CA 证书包来确保所有 SSL 连接的安全。这使得所有被认为“不安全”的连接都失败,除非使用 -k, --insecure。

试试这个兄弟。

【讨论】:

  • 不,不是这样。 TLS 交换很好,我之前尝试了很多东西,但不是 SSL 问题。
  • 我尝试在本地获取成功内容。我不知道你为什么失败:(
  • @yarek 你是在尝试 curl 到谷歌还是其他简单的东西?
最近更新 更多