没有-v,301卷曲不会显示

fid*_*NET 3 redirect curl http-status-code-301

我正在查看几个2.level域用于重定向到他们的www 3.level域的301,我认为卷曲本身就足够了,例如

curl  myvote.io
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.myvote.io/">here</A>.
</BODY></HTML>
Run Code Online (Sandbox Code Playgroud)

但是,我必须使用curl -v来获取另一个域上的任何输出:

curl -v evitaochel.com
* Rebuilt URL to: evitaochel.com/
* Hostname was NOT found in DNS cache
*   Trying 62.116.130.8...
* Connected to evitaochel.com (62.116.130.8) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.35.0
> Host: evitaochel.com
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Date: Mon, 13 Oct 2014 16:18:02 GMT
* Server Apache is not blacklisted
< Server: Apache
< Location: http://www.evitaochel.com
< Content-Length: 0
< Content-Type: text/html; charset=UTF-8 
<
* Connection #0 to host evitaochel.com left intact
Run Code Online (Sandbox Code Playgroud)

如果有的话,我期待myvote.io成为奇怪的一个,

curl -v myvore.io
* Rebuilt URL to: myvote.io/
* Hostname was NOT found in DNS cache
*   Trying 216.239.36.21...
* Connected to myvote.io (216.239.36.21) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.35.0
> Host: myvote.io
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Location: http://www.myvote.io/
< Date: Mon, 13 Oct 2014 16:30:40 GMT
< Content-Type: text/html; charset=UTF-8
* Server ghs is not blacklisted
< Server: ghs
< Content-Length: 218
< X-XSS-Protection: 1; mode=block
< X-Frame-Options: SAMEORIGIN
< Alternate-Protocol: 80:quic,p=0.01
<
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.myvote.io/">here</A>.
</BODY></HTML>
* Connection #0 to host myvote.io left intact
Run Code Online (Sandbox Code Playgroud)

显示它包含一些扩展,并由ghs提供服务,Google我猜.任何想法可能是什么原因,如果原因总是在"curl -v"中可见或可能是一些隐藏的配置?

Dan*_*erg 17

curl在没有任何选项的情况下使用时不显示任何响应头,这就是它的工作原理.使用-v或偶数-i只能查看标题.

重定向页面(301,302或其他)可以包含一个主体,但它也可能不包含.这取决于网站.

由于您获得了HTTP重定向,因此您可能也希望使用-L来使curl跟随它们.