似乎只能使用 HTTP/2 访问该 URL 处的页面,例如使用 cURL:
curl -v 'https://www.luisaviaroma.com/en-us/shop/home' \
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36'
给出:
* Using HTTP/2, 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 0x55d1310c6da0)
> GET /en-us/shop/home HTTP/1.1
> Host: www.luisaviaroma.com
> Accept: */*
> User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
>
* Connection state changed (MAX_CONCURRENT_STREAMS updated)!
< HTTP/2 200
< content-type: text/html; charset=utf-8
< server: Microsoft-IIS/8.5
< x-aspnet-version: 4.0.30319
< x-powered-by: ASP.NET
< access-control-allow-origin: *
< x-akamai-transformed: 9 - 0 pmb=mTOE,2
< expires: Mon, 13 Nov 2017 21:34:13 GMT
< cache-control: max-age=0, no-cache, no-store
< pragma: no-cache
< date: Mon, 13 Nov 2017 21:34:13 GMT
但是当强制使用 HTTP 1.0 或 HTTP 1.1 时,
curl -v 'https://www.luisaviaroma.com/en-us/shop/home' \
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36' \
--http1.0
它给出了不同的结果:
> GET /en-us/shop/home HTTP/1.0
> Host: www.luisaviaroma.com
> Accept: */*
> User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Server: Apache
< ETag: "9c027fecce6719909433b8a37b2b403a:1493300815"
< Last-Modified: Thu, 27 Apr 2017 13:46:55 GMT
< Accept-Ranges: bytes
< Content-Length: 31186
< Content-Type: text/html
< Expires: Mon, 13 Nov 2017 21:36:19 GMT
< Cache-Control: max-age=0, no-cache, no-store
< Pragma: no-cache
< Date: Mon, 13 Nov 2017 21:36:19 GMT
< Connection: close
使用 HTTP 1.0 或 HTTP 1.1,我们访问了服务不同页面的不同服务器,而使用 HTTP 2.0 它提供了预期的页面。
使用支持 HTTP 2.0 的 cURL,您将能够下载此页面,例如将其保存在 homepage.html 下:
curl 'https://www.luisaviaroma.com/en-us/shop/home' \
-H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36' \
-o homepage.html