使用 Meta 标签 “http-equiv” 属性进行页面跳转

今天打开 https://www.kfc.com.cn/, 发现自动跳转到了 http://www.kfc.com.cn/...., 没有实现全占 HTTPS, 于是拿出 curl 想看看他们怎么配置的, 于是 Got 到了一个新知识点。

如下,一般跳转我们会通过 301、302 等,但 curl 一下,发现他们没有这么配置, 直接返回了一个 html

$ curl -v  https://www.kfc.com.cn/                                                                                                                                                                                           at 08:18:32 PM
*   Trying 139.224.15.100...
* TCP_NODELAY set
* Connected to www.kfc.com.cn (139.224.15.100) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* ALPN, server accepted to use h2
* Server certificate:
*  subject: C=CN; ST=\U4E0A\U6D77\U5E02; O=\U767E\U80DC\U54A8\U8BE2\UFF08\U4E0A\U6D77\UFF09\U6709\U9650\U516C\U53F8; CN=*.kfc.com.cn
*  start date: Jan 27 00:00:00 2021 GMT
*  expire date: Feb 20 23:59:59 2022 GMT
*  subjectAltName: host "www.kfc.com.cn" matched cert's "*.kfc.com.cn"
*  issuer: C=US; O=DigiCert Inc; CN=DigiCert SHA2 Secure Server CA
*  SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x7f9ab880d600)
> GET / HTTP/2
> Host: www.kfc.com.cn
> User-Agent: curl/7.64.1
> Accept: */*
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 128)!
< HTTP/2 200
< date: Tue, 24 Aug 2021 12:18:37 GMT
< content-type: text/html; charset=utf-8
< content-length: 104
< last-modified: Fri, 04 May 2012 07:59:53 GMT
< accept-ranges: bytes
< etag: "7e7240e3cb29cd1:0"
< set-cookie: route-cell=ksa; path=/
< set-cookie: SERVERID=d6c34e519e43f6263bd06aa0de6e84c9|1629807517|1629807517;Path=/
<
<html>
        <META HTTP-EQUIV="refresh" content="0; url=http://www.kfc.com.cn/kfccda/index.aspx">
</html>
* Connection #0 to host www.kfc.com.cn left intact
* Closing connection 0

也就是这段:

<html>
        <META HTTP-EQUIV="refresh" content="0; url=http://www.kfc.com.cn/kfccda/index.aspx">
</html>

然后了解到,原来这样也是可以做跳转的,其中 content 是延迟多久跳转, url 是目标网址。

更多相关可看 :文档级元数据元素

本文链接:参与评论 »

--EOF--

Comments