在 Catalina OSX 10.15.1 上使用 curl 上传 zip 时出错

在 Catalina OSX 10.15.1 上使用 curl 上传 zip 时出错

使用 OSx 中预装的 curl 命令工具。

命令如下:

curl -v -H 'Authorization:Bearer xxx' -H 'Accept:application/json' -F 'funzione=uploadPacket' -F 'folder_id=159' -F 'userfile=@//Users/mediabook/Desktop/forCatalina.zip' https://mysite/api/extGetNote

在以前的系统中它可以正常工作。现在 Catalina (OSX 10.15.0 和 10.15.1) 报告此错误:

curl: (92) HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)

详细:

*   Trying 95.141.37.143...
* TCP_NODELAY set
* Connected to mysite (95.141.37.143) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
 CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (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 change cipher, Change cipher spec (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use h2
* Server certificate:
*  subject: CN= mysite
*  start date: Oct 22 08:06:23 2019 GMT
*  expire date: Jan 20 08:06:23 2020 GMT
*  subjectAltName: host "mysite" matched cert's "mysite"
*  issuer: C=US; O=Let's Encrypt; CN=Let's Encrypt Authority X3
*  SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x7fb230008c00)
POST /api/extGetNote HTTP/2
Host: mysite
User-Agent: curl/7.64.1
Authorization:Bearer xxx
Accept:application/json
Content-Length: 160026
Content-Type: multipart/form-data; boundary=------------------------6cec1f7bf39b0dbf

* Connection state changed (MAX_CONCURRENT_STREAMS == 128)!
* We are completely uploaded and fine
* HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)
* stopped the pause stream!
* Connection #0 to host mysite left intact
curl: (92) HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)
* Closing connection 0

带 jpeg 附件的相同命令有效!只有 zip 文件出错。文件大小为 160 KB….

有任何想法吗?

谢谢!

答案1

您正在使用 HTTP/2。请将该选项添加--http1.1到您的curl命令中。

相关内容