Curl请求在一台服务器上不完整,但在另一台服务器上不完整

Curl请求在一台服务器上不完整,但在另一台服务器上不完整,curl,Curl,我在跑步 curl -L -v http://www.homeaway.com/icalendar/594a74016bdb4733bb9645bce1b0e056.ics 在Ubuntu14.04服务器上,curl版本为7.35.0。一台服务器返回ical数据,另一台不返回。此外,其中一个找到301重定向(有效的一个),但另一个找到302重定向并无限重定向,直到达到最大重定向并停止。我尝试了大量的curl配置更改,尝试了使用wget,并更新了curl。任何想法或方向都将不胜感激。这是302

我在跑步

curl -L -v http://www.homeaway.com/icalendar/594a74016bdb4733bb9645bce1b0e056.ics 
在Ubuntu14.04服务器上,curl版本为7.35.0。一台服务器返回ical数据,另一台不返回。此外,其中一个找到301重定向(有效的一个),但另一个找到302重定向并无限重定向,直到达到最大重定向并停止。我尝试了大量的curl配置更改,尝试了使用wget,并更新了curl。任何想法或方向都将不胜感激。这是302循环中单个循环的样子:

Hostname was NOT found in DNS cache
*   Trying 107.154.106.208...
* Connected to www.homeaway.com (107.154.106.208) port 80 (#0)
> GET /icalendar/594a74016bdb4733bb9645bce1b0e056.ics HTTP/1.1
> User-Agent: curl/7.35.0
> Host: www.homeaway.com
> Accept: */*
> 
< HTTP/1.1 302 Found
< Cache-Control: no-cache
< Content-Type: text/html
< Connection: close
< Content-Length: 122
< X-Iinfo: 5-4916587-0 0NNN RT(1495125118547 0) q(0 -1 -1 -1) r(0 -1) B13 U5
< Set-Cookie: visid_incap_1035332=JB0pwkNGTkOCyEUTYg7cb37MHVkAAAAAQUIPAAAAAADrP8ljgfgiwHsfPUMI46fW; expires=Fri, 18 May 2018 11:07:17 GMT; path=/; Domain=.homeaway.com
< Set-Cookie: incap_ses_569_1035332=Mg7bBj4GhTbW6+3GuH7lB37MHVkAAAAAqWW90tU6R3hT1MDWDGb39w==; path=/; Domain=.homeaway.com
< Location: /icalendar/594a74016bdb4733bb9645bce1b0e056.ics
< 
* Closing connection 0
* Issue another request to this URL: 'http://www.homeaway.com/icalendar/594a74016bdb4733bb9645bce1b0e056.ics'
* Hostname was found in DNS cache
*   Trying 107.154.106.208...
* Connected to www.homeaway.com (107.154.106.208) port 80 (#1)
> GET /icalendar/594a74016bdb4733bb9645bce1b0e056.ics HTTP/1.1
> User-Agent: curl/7.35.0
> Host: www.homeaway.com
> Accept: */*
> 
* Hostname was NOT found in DNS cache
*   Trying 107.154.108.208...
* Connected to www.homeaway.com (107.154.108.208) port 80 (#0)
> GET /icalendar/594a74016bdb4733bb9645bce1b0e056.ics HTTP/1.1
> User-Agent: curl/7.35.0
> Host: www.homeaway.com
> Accept: */*
> 
< HTTP/1.1 301 Moved Permanently
* Server Varnish is not blacklisted
< Server: Varnish
< Retry-After: 0
< Location: https://www.homeaway.com/icalendar/594a74016bdb4733bb9645bce1b0e056.ics
< Content-Length: 0
< Accept-Ranges: bytes
< Date: Thu, 18 May 2017 16:33:27 GMT
< Via: 1.1 varnish
< Connection: close
< X-Served-By: cache-dfw1820-DFW
< X-Cache: HIT
< X-Cache-Hits: 0
< HA-ipaddr: 24.116.227.3
< HA-host: www.homeaway.com
< HA-georegion: CA
< HA-geocountry: US
< HA-geocity: Redwood City
< HA-geolat: 37.533
< HA-geolon: -122.247
< HA-servedtime: 0
< HA-cloudapp: false
< Set-Cookie: visid_incap_1035332=E9ljCatpS/+i0YTf8KsHptfMHVkAAAAAQUIPAAAAAAAKepipXFv110qeDR48cfqS; expires=Fri, 18 May 2018 10:02:06 GMT; path=/; Domain=.homeaway.com
< Set-Cookie: incap_ses_518_1035332=yH9zGlNRzF7PZmOUkE4wB9fMHVkAAAAA6ipeeDZi9xWYXM2B03XPzg==; path=/; Domain=.homeaway.com
< Set-Cookie: ___utmvmVauIZsM=BKkDoCkVOQl; path=/; Max-Age=900
< Set-Cookie: ___utmvaVauIZsM=EFBhHAs; path=/; Max-Age=900
< Set-Cookie: ___utmvbVauIZsM=bZD
<     XxqOSalt: Wtt; path=/; Max-Age=900
< X-Iinfo: 9-7076089-7076090 NNNN CT(0 -1 0) RT(1495125207240 0) q(0 0 0 -1) r(0 0) U5
< X-CDN: Incapsula
< 
* Closing connection 0
* Issue another request to this URL: 'https://www.homeaway.com/icalendar/594a74016bdb4733bb9645bce1b0e056.ics'
* Hostname was NOT found in DNS cache
*   Trying 107.154.108.208...
* Connected to www.homeaway.com (107.154.108.208) port 443 (#1)
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server key exchange (12):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using ECDHE-RSA-AES256-GCM-SHA384
* Server certificate:
*        subject: 1.3.6.1.4.1.311.60.2.1.3=US; 1.3.6.1.4.1.311.60.2.1.2=Delaware; businessCategory=Private Organization; serialNumber=3909505; C=US; ST=Texas; L=Austin; O=HomeAway.com, Inc.; OU=Akamai SAN SSL OV; CN=www.homeaway.com
*        start date: 2016-02-17 00:00:00 GMT
*        expire date: 2017-11-23 23:59:59 GMT
*        subjectAltName: www.homeaway.com matched
*        issuer: C=US; O=GeoTrust Inc.; CN=GeoTrust EV SSL CA - G4
*        SSL certificate verify ok.
> GET /icalendar/594a74016bdb4733bb9645bce1b0e056.ics HTTP/1.1
> User-Agent: curl/7.35.0
> Host: www.homeaway.com
> Accept: */*
> 
< HTTP/1.1 200 OK
我的环看起来像

 < HTTP/1.1 302 Found
< Cache-Control: no-cache
< Content-Type: text/html
< Connection: close
< Content-Length: 122
< X-Iinfo: 4-3164187-0 0NNN RT(1495127489319 48) q(0 -1 -1 -1) r(0 -1) B13 U5
< Set-Cookie: visid_incap_1035332=FQUo2l87SVqx1fC6sS28OsHVHVkAAAAAQUIPAAAAAAACGLOeMWa+FZl70K1N2jw9; expires=Fri, 18 May 2018 11:07:17 GMT; path=/; Domain=.homeaway.com
< Set-Cookie: incap_ses_569_1035332=Z3XYY2VRGBMAvvDGuH7lB8HVHVkAAAAAWGrGpz2qvyB+968S/JClHA==; path=/; Domain=.homeaway.com
< Location: /icalendar/594a74016bdb4733bb9645bce1b0e056.ics
< 
* Closing connection 49
* SSLv3, TLS alert, Client hello (1):
* Issue another request to this URL: 'https://www.homeaway.com/icalendar/594a74016bdb4733bb9645bce1b0e056.ics'
* Hostname was found in DNS cache
*   Trying 107.154.106.208...
* Connected to www.homeaway.com (107.154.106.208) port 443 (#50)
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSL re-using session ID
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using ECDHE-RSA-AES256-GCM-SHA384
* Server certificate:
*        subject: 1.3.6.1.4.1.311.60.2.1.3=US; 1.3.6.1.4.1.311.60.2.1.2=Delaware; businessCategory=Private Organization; serialNumber=3909505; C=US; ST=Texas; L=Austin; O=HomeAway.com, Inc.; OU=Akamai SAN SSL OV; CN=www.homeaway.com
*        start date: 2016-02-17 00:00:00 GMT
*        expire date: 2017-11-23 23:59:59 GMT
*        subjectAltName: www.homeaway.com matched
*        issuer: C=US; O=GeoTrust Inc.; CN=GeoTrust EV SSL CA - G4
*        SSL certificate verify ok.
> GET /icalendar/594a74016bdb4733bb9645bce1b0e056.ics HTTP/1.1
> User-Agent: curl/7.35.0
> Host: www.homeaway.com
> Accept: */*
> 
< HTTP/1.1 302 Found
< Cache-Control: no-cache
< Content-Type: text/html
< Connection: close
< Content-Length: 122
< X-Iinfo: 10-2472735-0 0NNN RT(1495127489372 45) q(0 -1 -1 -1) r(0 -1) B13 U5
< Set-Cookie: visid_incap_1035332=jm6FGq2LSGyifOkF2i/qE8HVHVkAAAAAQUIPAAAAAABWQHemFUGMHL4tMetrPT9U; expires=Fri, 18 May 2018 11:07:17 GMT; path=/; Domain=.homeaway.com
< Set-Cookie: incap_ses_569_1035332=p6joe+GkqHMEvvDGuH7lB8HVHVkAAAAAb141TSz+5Byhkhhdp0LnHQ==; path=/; Domain=.homeaway.com
< Location: /icalendar/594a74016bdb4733bb9645bce1b0e056.ics
找到HTTP/1.1 302 <缓存控制:无缓存 GET/icalendar/594a74016bdb4733bb9645bce1b0e056.ics HTTP/1.1 >用户代理:curl/7.35.0 >主持人:www.homeaway.com >接受:*/* > 找到 我想我会把最后一个更新放在这里。这显示HomeAway服务器返回的403:

$ curl -v --resolve www.homeaway.com:80:107.154.108.208 http://www.homeaway.com/icalendar/594a74016bdb4733bb9645bce1b0e056.ics
* Added www.homeaway.com:80:107.154.108.208 to DNS cache
* Hostname was found in DNS cache
*   Trying 107.154.108.208...
* Connected to www.homeaway.com (107.154.108.208) port 80 (#0)
> GET /icalendar/594a74016bdb4733bb9645bce1b0e056.ics HTTP/1.1
> User-Agent: curl/7.35.0
> Host: www.homeaway.com
> Accept: */*
> 
< HTTP/1.1 403 Forbidden
< Content-Type: text/html
< Cache-Control: no-cache
< Connection: close
< Content-Length: 784
< X-Iinfo: 8-41132527-0 0NNN RT(1495132361269 1) q(0 -1 -1 0) r(0 -1) B15(11,21523,0) U5
< Set-Cookie: visid_incap_1035332=SmCNYymNTSuv2XKWs09ccMnoHVkAAAAAQUIPAAAAAACq1DmpWDPt+01ypagF2nUE; expires=Fri, 18 May 2018 10:15:56 GMT; path=/; Domain=.homeaway.com
< Set-Cookie: incap_ses_552_1035332=aDTBCFZUxBT2TrnaVhmpB8noHVkAAAAAPHLRRsXuxnvRNF6uOcFS4A==; path=/; Domain=.homeaway.com
< 
* Closing connection 0
<html style="height:100%"><head><META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"><meta name="format-detection" content="telephone=no"><meta name="viewport" content="initial-scale=1.0"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><script type="text/javascript" src="/_Incapsula_Resource?SWJIYLWA=2977d8d74f63d7f8fedbea018b7a1d05"></script></head><body style="margin:0px;height:100%"><iframe src="/_Incapsula_Resource?CWUDNSAI=1&xinfo=8-41132527-0 0NNN RT(1495132361269 1) q(0 -1 -1 0) r(0 -1) B15(11,21523,0) U5&incident_id=552000290157055734-292194162850660824&edet=15&cinfo=0b000000" frameborder=0 width="100%" height="100%" marginheight="0px" marginwidth="0px">Request unsuccessful. Incapsula incident ID: 552000290157055734-292194162850660824</iframe></body></html>
$curl-v--解析www.homeaway.com:80:107.154.108.208http://www.homeaway.com/icalendar/594a74016bdb4733bb9645bce1b0e056.ics
*将www.homeaway.com:80:107.154.108.208添加到DNS缓存
*在DNS缓存中找到主机名
*正在尝试107.154.108.208。。。
*已连接到www.homeaway.com(107.154.108.208)端口80(#0)
>GET/icalendar/594a74016bdb4733bb9645bce1b0e056.ics HTTP/1.1
>用户代理:curl/7.35.0
>主持人:www.homeaway.com
>接受:*/*
> 
坏服务器响应重定向到HTTP(80) ->

良好的服务器响应重定向到HTTPS(443) ->

这不是客户的问题。查看服务器设置

编辑:

您可以使用
--resolve
选项测试特定服务器

curl -v --resolve www.homeaway.com:80:107.154.106.208 http://www.homeaway.com/icalendar/594a74016bdb4733bb9645bce1b0e056.ics

curl -v --resolve www.homeaway.com:80:107.154.108.208 http://www.homeaway.com/icalendar/594a74016bdb4733bb9645bce1b0e056.ics

我正在调查您得到的这个确切的HTML响应,它加强了我最初的假设:这是由Incapsula返回的(您得到的cookies与我得到的相同)


我知道我的组织在我们的服务器上使用Incapsula,所以这完全有道理。

Resolve告诉我大致相同的事情:“找到HTTP/1.1 302”然后“加载加载*关闭连接0”我想我明白你现在说的了。107.154.108.208为我的digital ocean服务器提供了403。我不知道我要做什么才能让它工作。谢谢你的洞察力@我所在的CurtisKelsey Curl请求收到有效响应。也许你有缓存问题。尝试添加查询字符串以避免缓存命中<代码>curl-v--解析www.homeaway.com:80:107.154.106.208http://www.homeaway.com/icalendar/594a74016bdb4733bb9645bce1b0e056.ics?xxx尝试了查询字符串,没有乐趣。仍然返回302。当然是个好主意。
curl -v --resolve www.homeaway.com:80:107.154.106.208 http://www.homeaway.com/icalendar/594a74016bdb4733bb9645bce1b0e056.ics

curl -v --resolve www.homeaway.com:80:107.154.108.208 http://www.homeaway.com/icalendar/594a74016bdb4733bb9645bce1b0e056.ics