Curl - 将捆绑包标记为不支持多用途 < HTTP/1.1 403

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

我正在尝试登录 API。我按照教程进行操作,然后,我必须运行此命令:

export ID1=`curl -k --tlsv1.2 -b cookie.txt -c cookie.txt -v 'https://api-gateway.inpi.fr/auth/login' -H 'Accept: application/json, text/plain, */*' -H "X-XSRF-TOKEN: $TOKEN" -H 'Content-Type: application/json' -H 'Connection: keep-alive' -H "Cookie: XSRF-TOKEN= $TOKEN" --data '{"username":"[email address]","password":"[account password]","rememberMe":true}'`

但它返回了:

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 81.252.220.43:443...
* Connected to api-gateway.inpi.fr (81.252.220.43) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [108 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [5187 bytes data]
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [589 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [70 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
} [1 bytes data]
* TLSv1.2 (OUT), TLS handshake, Finished (20):
} [16 bytes data]
* TLSv1.2 (IN), TLS handshake, Finished (20):
{ [16 bytes data]
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: C=FR; ST=�le-de-France; L=Courbevoie; O=Institut National de la Propri�t� Industrielle; CN=*.inpi.fr
*  start date: Mar 12 13:13:03 2021 GMT
*  expire date: Mar 12 13:23:00 2022 GMT
*  issuer: C=BM; O=QuoVadis Limited; CN=QuoVadis Global SSL ICA G3
*  SSL certificate verify result: self signed certificate in certificate chain (19), continuing anyway.
} [5 bytes data]
> POST /auth/login HTTP/1.1
> Host: api-gateway.inpi.fr
> User-Agent: curl/7.81.0
> Cookie: XSRF-TOKEN=[my XSRF-TOKEN]
> Accept: application/json, text/plain, */*
> Content-Type: application/json
> Connection: keep-alive
> Cookie: XSRF-TOKEN= 
> Content-Length: 85
> 
} [85 bytes data]
* Mark bundle as not supporting multiuse
< HTTP/1.1 403 
< Date: Fri, 18 Feb 2022 09:26:51 GMT
< Server: Apache
< x-csrf-token: Fetch
< Vary: Origin,Access-Control-Request-Method,Access-Control-Request-Headers
< Cache-Control: no-store
< Pragma: no-cache
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Content-Security-Policy: default-src 'self'; frame-src 'self' data:; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://storage.googleapis.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; img-src 'self'; font-src 'self' data: https://fonts.gstatic.com
< Referrer-Policy: same-origin
< Feature-Policy: geolocation 'none'; midi 'none'; sync-xhr 'none'; microphone 'none'; camera 'none'; magnetometer 'none'; gyroscope 'none'; speaker 'none'; fullscreen 'self'; payment 'none'
< Content-Type: application/json
< Strict-Transport-Security: max-age=63072000; includeSubDomains
< Keep-Alive: timeout=5, max=100
< Connection: Keep-Alive
< Transfer-Encoding: chunked
< 
{ [148 bytes data]
100   227    0   142  100    85    838    501 --:--:-- --:--:-- --:--:--  1343
* Connection #0 to host api-gateway.inpi.fr left intact

我认为最有趣的部分是:

} [85 bytes data]
* Mark bundle as not supporting multiuse
< HTTP/1.1 403 
< Date: Fri, 18 Feb 2022 09:26:51 GMT
< Server: Apache

当我跑步

curl --version
时,我:

curl 7.81.0 (x86_64-pc-linux-gnu) libcurl/7.81.0 OpenSSL/1.1.1m zlib/1.2.11 brotli/1.0.9 zstd/1.5.1 libidn2/2.3.2 libssh2/1.10.0 nghttp2/1.46.0 librtmp/2.3 OpenLDAP/2.6.0
Release-Date: 2022-01-05
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB SPNEGO SSL TLS-SRP UnixSockets zstd

我尝试了在这个论坛上找到的解决方案:curl 无法授权下载 所以,添加

--http0.9
标志,但没有区别

bash curl tls1.2
2个回答
6
投票

这不是一条错误消息,而是一条没有任何后果的调试跟踪消息。

这意味着curl知道连接不是http/2。就这些;除了以 --verbose 模式打印的状态消息之外,它不提供任何信息(例如“HTTP/1.1 200 OK”)

一些历史

  • 此消息是通过提交引入的 c32248f
  • 它首次出现在curl 7.65.0中
  • 当使用“--enable-verbose”配置curl时启用该消息,这是默认的构建选项
  • 当curl使用--verbose或-v运行时,或者当libcurl easy句柄配置为CURLOPT_VERBOSE = 1时显示
  • 上面的提交表明其目的是修复以下错误:
    • #3813 - “curl 在 pipelinewait=1 的 http/1.1 并发请求上以 100% cpu 使用率挂起”
    • #3814 - “改进了非复用情况”

虽然该提交确实解决了之前存在的错误,但消息“将捆绑包标记为不支持多用途”只能被视为开发疤痕。

更新:这条多余的消息已在 7.88.0 中通过提交 73477d5

删除

3
投票

您可以尝试更改curl请求http版本。我添加了 --http1.1 我用这种方式解决了我的问题。

curl --http1.1 -X PUT....

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