Debian12.5-curl:(52)来自服务器的空回复

问题描述 投票:0回答:1

我尝试在 DHL api 上进行卷曲。 如果我的 IP 可能被阻止,我已经写信给 DHL,但他们确认没有被阻止... 来自其他服务器的相同调用也正常。 但从我的服务器结果是:curl: (52) Empty returned from server 我不知道问题是否与 TLS 或其他有关..有人可以帮助我找到问题出在哪里? 这是一个卷曲调用:

curl -v -k -X -L GET 'https://api-eu.dhl.com/track/shipments?trackingNumber=7670087740' -H 'DHL-API-Key: WGP0HGo26c5OFRclZHqPHTAEpXXXXXXX'
*   Trying 172.66.40.55:80...
* Connected to GET (172.66.40.55) port 80 (#0)
> -L / HTTP/1.1
> Host: GET
> User-Agent: curl/7.88.1
> Accept: */*
> DHL-API-Key: WGP0HGo26c5OFRclZHqPHTAEpXXXXXXX
>
< HTTP/1.1 403 Forbidden
< Date: Fri, 28 Jun 2024 21:10:23 GMT
< Content-Type: text/plain; charset=UTF-8
< Content-Length: 16
< Connection: close
< X-Frame-Options: SAMEORIGIN
< Referrer-Policy: same-origin
< Cache-Control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
< Expires: Thu, 01 Jan 1970 00:00:01 GMT
< Server: cloudflare
< CF-RAY: 89b0a9cc4e284c78-HEL
<
* Closing connection 0
error code: 1003*   Trying 34.89.220.138:443...
* Connected to api-eu.dhl.com (34.89.220.138) port 443 (#1)
* ALPN: offers h2,http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN: server accepted http/1.1
* Server certificate:
*  subject: C=DE; ST=Nordrhein-Westfalen; L=Bonn; O=Deutsche Post AG; CN=api.dhl.com
*  start date: Apr  2 06:41:20 2024 GMT
*  expire date: Apr  2 06:40:20 2025 GMT
*  issuer: C=DE; O=Deutsche Post AG; CN=DPDHL Global TLS CA - I5
*  SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
* using HTTP/1.1
> -L /track/shipments?trackingNumber=7670087740 HTTP/1.1
> Host: api-eu.dhl.com
> User-Agent: curl/7.88.1
> Accept: */*
> DHL-API-Key: WGP0HGo26c5OFRclZHqPHTAEpXXXXXXX
>
* Empty reply from server
* Closing connection 1
* TLSv1.2 (OUT), TLS alert, close notify (256):
curl: (52) Empty reply from server

我也尝试使用参数“--tlsv1.2”强制使用 TLS1.2,但也不起作用

curl openssl debian
1个回答
0
投票

HTTP/1.1 403 Forbidden
是您应该调查的内容。查看请求转储

> -L / HTTP/1.1
> Host: GET

你看这是完全错误的。为什么?因为您在

-L
及其值
-X
之间插入了
GET
,并使请求类型为
-L
和地址
GET
,幸运的是解析为
172.66.40.55)

-X -L GET

移除

-L
或将其移到外面
-X GET

© www.soinside.com 2019 - 2024. All rights reserved.