cURL在GitHub操作中失败

时间:2020-09-19 09:17:35

标签: github curl github-actions

我正在运行Raspberry Pi 4作为我的.NET Core副项目的服务器。没有什么太花哨或沉重的。在尝试使用Webhook并将带有scp的文件上传到Pi并失败之后(仍然不知道为什么; scp问题可能与cURL问题相同),我决定使自己成为一个小型API,可以接受文件并将其部署到指定路径。该API在Pi的内部和外部都可以正常工作,因为我已经使用cURL和Postman使用20MB的zip文件对其进行了测试,但是当我从GitHub Action内部运行此命令时,等待时间很长,然后出现失败消息

命令:

curl --request POST --url https://example.com/ --header 'cache-control: no-cache' --form path=DEPLOY_PATH --form archive=@FILE_PATH --form token=TOKEN

输出:

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                               Dload  Upload   Total   Spent    Left  Speed
            
0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
0 8776k    0     0    0 65536      0  42750  0:03:30  0:00:01  0:03:29 42722
0 8776k    0     0    0 65536      0  25862  0:05:47  0:00:02  0:05:45 25852
0 8776k    0     0    0 65536      0  18533  0:08:04  0:00:03  0:08:01 18528
0 8776k    0     0    0 65536      0  14444  0:10:22  0:00:04  0:10:18 14441
0 8776k    0     0    0 65536      0  11833  0:12:39  0:00:05  0:12:34 13091
0 8776k    0     0    0 65536      0  10022  0:14:56  0:00:06  0:14:50     0
0 8776k    0     0    0 65536      0   8691  0:17:14  0:00:07  0:17:07     0
...
0 8776k    0     0    0 65536      0     63 39:37:37  0:17:11 39:20:26     0
0 8776k    0     0    0 65536      0     63 39:37:37  0:17:11 39:20:26     0
curl: (55) SSL_write() returned SYSCALL, errno = 110
##[error]Process completed with exit code 55.

使用scp和cURL命令似乎都存在一个常见问题。如果我尝试发送一个简单的文本文件或包含text.file的tar.gz,它会起作用。如果我尝试对.dll文件或包含.dll文件的tar.gz执行相同操作,则不会。我真的不知道问题是否出在文件或文件大小上。需要注意的是,该API目前接受的文件最大为100MB,而我仅尝试部署一个约10MB的小程序包。

带有-v arg的输出:

 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying IP...
* TCP_NODELAY set

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to URL (IP) 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
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
} [512 bytes data]
* TLSv1.3 (IN), TLS handshake, Server hello (2):
{ [112 bytes data]
* TLSv1.2 (IN), TLS handshake, Certificate (11):
{ [2861 bytes data]
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
{ [300 bytes data]
* TLSv1.2 (IN), TLS handshake, Server finished (14):
{ [4 bytes data]
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
} [37 bytes data]
* TLSv1.2 (OUT), TLS change cipher, Client hello (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-CHACHA20-POLY1305
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: CN=URL
*  start date: Sep 18 16:51:41 2020 GMT
*  expire date: Dec 17 16:51:41 2020 GMT
*  subjectAltName: host "URL" matched cert's "URL"
*  issuer: C=US; O=Let's Encrypt; CN=Let's Encrypt Authority X3
*  SSL certificate verify ok.
} [5 bytes data]
> POST /api/Deployment/ HTTP/1.1
> Host: URL
> User-Agent: curl/7.58.0
> Accept: */*
> cache-control: no-cache
> Content-Length: 3333
> Content-Type: multipart/form-data; boundary=------------------------ca1748c91973ca89
> Expect: 100-continue
> 
{ [5 bytes data]
< HTTP/1.1 100 Continue
} [5 bytes data]

100  3333    0     0  100  3333      0   2154  0:00:01  0:00:01 --:--:--  2153
100  3333    0     0  100  3333      0   1307  0:00:02  0:00:02 --:--:--  1307
100  3333    0     0  100  3333      0    938  0:00:03  0:00:03 --:--:--   938
100  3333    0     0  100  3333      0    732  0:00:04  0:00:04 --:--:--   732
100  3333    0     0  100  3333      0    600  0:00:05  0:00:05 --:--:--   614
100  3333    0     0  100  3333      0    508  0:00:06  0:00:06 --:--:--     0
100  3333    0     0  100  3333      0    441  0:00:07  0:00:07 --:--:--     0
...
100  3333    0     0  100  3333      0     57  0:00:58  0:00:57  0:00:01     0
100  3333    0     0  100  3333      0     56  0:00:59  0:00:58  0:00:01     0
100  3333    0     0  100  3333      0     55  0:01:00  0:00:59  0:00:01     0
100  3333    0     0  100  3333      0     54  0:01:01  0:01:00  0:00:01     0* Empty reply from server

100  3333    0     0  100  3333      0     54  0:01:01  0:01:00  0:00:01     0
* Connection #0 to host URL left intact
curl: (52) Empty reply from server
##[error]Process completed with exit code 52.

编辑:切换到Windows运行程序而不是Ubuntu可以解决cURL问题,但是我仍然愿意就此问题提出建议,因为这只是解决方法,而不是解决方案。

0 个答案:

没有答案