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

时间:2017-05-18 16:36:57

标签: curl

我正在运行

curl -L -v http://www.homeaway.com/icalendar/594a74016bdb4733bb9645bce1b0e056.ics 

在具有curl版本7.35.0的Ubuntu 14.04服务器上。一台服务器返回ical数据,一台没有。 Moreso发现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

更新:

有效的请求在我的本地主机上,我已经在我们所有的数字海洋水滴上尝试了请求,如果没有遵循重定向则接收403,如果遵循则重定向302无限循环。

如果我将请求修改为

curl -L -v https://www.homeaway.com/icalendar/594a74016bdb4733bb9645bce1b0e056.ics 

我的循环看起来像

 < 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

以为我会把最后一次更新放在这里。这显示了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>

2 个答案:

答案 0 :(得分:0)

错误的服务器响应重定向到HTTP(80) http://www.homeaway.com/icalendar/594a74016bdb4733bb9645bce1b0e056.ics - &GT; http://www.homeaway.com/icalendar/594a74016bdb4733bb9645bce1b0e056.ics

好的服务器响应重定向到HTTPS(443) http://www.homeaway.com/icalendar/594a74016bdb4733bb9645bce1b0e056.ics - &GT; https://www.homeaway.com/icalendar/594a74016bdb4733bb9645bce1b0e056.ics

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

修改

您可以使用--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

答案 1 :(得分:0)

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

我知道我的组织在我们的服务器上使用了Incapsula,因此这是完全合理的。