来自Heroku的curl事务失败

时间:2014-09-17 13:10:01

标签: curl heroku

我正在尝试通过亚马逊以卷曲方式从Heroku中提取数据库备份,并且我一直在获取空文件。交易的基本形式是:

 curl -o latest-dump `heroku pgbackups:url`

当然,后面的滴答是将其作为动态插入长URL的命令运行。我放弃了在CMD中这样做,并试图在cygwin中这样做,因为至少它理解后面的滴答声。

我可以在我的个人Mac上成功运行此命令,因此我很难理解为什么它无法按预期提供文件。

当我使用verbose选项运行curl命令时,唯一的指示是400 Bad Request,这让我觉得heroku命令的输出被破坏了。所以我复制了heroku命令的输出并尝试了它:

 curl -v -o latest.dump 'https://s3.amazonaws.com/hkpgbackups/app28197640@heroku.com/xxxx.dump?AWSAccessKeyId=AKIAJSCBEZJRDOTGNGZQ&Expires=1410954117&Signature=pOgPFgADIvrWT%2FfBT6MXQFxhWhc%3D'

它的输出低于但我没有看到错误?

 * STATE: INIT => CONNECT handle 0x6000565f0; line 1028 (connection #-5000)
 * Hostname was NOT found in DNS cache
 *   Trying 54.231.14.80...
 * STATE: CONNECT => WAITCONNECT handle 0x6000565f0; line 1076 (connection #0)
   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                  Dload  Upload   Total   Spent    Left  Speed
   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to      s3.amazonaws.com (54.231.14.80) port 443 (#0)
 * successfully set certificate verify locations:
 *   CAfile: /usr/ssl/certs/ca-bundle.crt
   CApath: none
 * SSLv3, TLS handshake, Client hello (1):
 } [data not shown]
 * STATE: WAITCONNECT => PROTOCONNECT handle 0x6000565f0; line 1189 (connection #0)
 * SSLv3, TLS handshake, Server hello (2):
 { [data not shown]
 * SSLv3, TLS handshake, CERT (11):
 { [data not shown]
 * SSLv3, TLS handshake, Server finished (14):
 { [data not shown]
 * SSLv3, TLS handshake, Client key exchange (16):
 } [data not shown]
 * SSLv3, TLS change cipher, Client hello (1):
 } [data not shown]
 * SSLv3, TLS handshake, Finished (20):
 } [data not shown]
 * SSLv3, TLS change cipher, Client hello (1):
 { [data not shown]
 * SSLv3, TLS handshake, Finished (20):
 { [data not shown]
 * SSL connection using TLSv1.2 / AES128-SHA
 * Server certificate:
 *        subject: C=US; ST=Washington; L=Seattle; O=Amazon.com Inc.; CN=s3.amazonaws.com
 *        start date: 2014-04-12 00:00:00 GMT
 *        expire date: 2015-04-13 23:59:59 GMT
 *        subjectAltName: s3.amazonaws.com matched
 *        issuer: C=US; O=VeriSign, Inc.; OU=VeriSign Trust Network; OU=Terms of use at https://www.verisign.com/rpa (c)10; CN=VeriSign Class 3 Secure Server CA - G3
 *        SSL certificate verify ok.
 * STATE: PROTOCONNECT => DO handle 0x6000565f0; line 1208 (connection #0)
 > GET /hkpgbackups/app28197640@heroku.com/xxxx.dump?AWSAccessKeyId=AKIAJSCBEZJRDOTGNGZQ&Expires=1410954117&Signature=pOgPFgADIvrWT%2FfBT6MXQFxhWhc%3D      HTTP/1.1
 > User-Agent: curl/7.37.1
 > Host: s3.amazonaws.com
 > Accept: */*
 >
 * STATE: DO => DO_DONE handle 0x6000565f0; line 1281 (connection #0)
 * STATE: DO_DONE => WAITPERFORM handle 0x6000565f0; line 1407 (connection #0)
 * STATE: WAITPERFORM => PERFORM handle 0x6000565f0; line 1420 (connection #0)
 * HTTP 1.1 or later with persistent connection, pipelining supported
 < HTTP/1.1 403 Forbidden
 < x-amz-request-id: A4C8B6D374B54A17
 < x-amz-id-2: X52WUUKWvGDZ+FCPh2fGtecBY2zEeZHmelLDCzuXY1q9G7sBoR0jO/BpS15WP9nsUTDDiRQEvR8=
 < Content-Type: application/xml
 < Transfer-Encoding: chunked
 < Date: Wed, 17 Sep 2014 12:26:01 GMT
 * Server AmazonS3 is not blacklisted
 < Server: AmazonS3
 <
 { [data not shown]
 * STATE: PERFORM => DONE handle 0x6000565f0; line 1590 (connection #0)
 100   333    0   333    0     0   2221      0 --:--:-- --:--:-- --:--:--  2752
 * Connection #0 to host s3.amazonaws.com left intact
 * Expire cleared

这个网址有什么特别的东西在这里打扰我吗?它确实似乎改变了它的签名?帮助我看看我在这里缺少的东西,感谢,山姆

2 个答案:

答案 0 :(得分:0)

这应该按原样运行,但是一位朋友查看了它,发现该URL由heroku.bat程序提供。由于Heroku URL非常长,Windows端不断在URL中添加回车符。我会从亚马逊那里得到400个错误。大概如果它是heroku.sh它应该没有修改但是现在可以在cygwin中运行:

curl -o latest.dump -l&#34; $(heroku.bat pgbackups:url | dos2unix)&#34;

感谢Naaman Newbold没有放弃这个问题。

答案 1 :(得分:0)

我有同样的问题。我在Google Chrome中按原样粘贴了网址,并为我下载了该文件。