curl command to test whether the server supports HTTP

curl -i --range 0-9 http://www.baidu.com/img/bdlogo.gif
HTTP/1.1 206 Partial Content
Date: Thu, 13 Mar 2014 00:20:10 GMT
Server: Apache
P3P: CP=" OTI DSP COR IVA OUR IND COM "
Set-Cookie: BAIDUID=AC9512E1E6932D67A05F4F090DE836FC:FG=1; expires=Fri, 13-Mar-15 00:20:10 GMT; 

max-age=31536000; path=/; domain=.baidu.com; version=1
Last-Modified: Fri, 22 Feb 2013 03:45:02 GMT
ETag: "627-4d648041f6b80"
Accept-Ranges: bytes
Content-Length: 10
Cache-Control: max-age=315360000
Expires: Sun, 10 Mar 2024 00:20:10 GMT
Content-Range: bytes 0-9/1575
Connection: Keep-Alive
Content-Type: image/gif

The above is a curl to get the response headers, which can be found if Content-Range indicates that the server supports HTTP, some servers will return Accept-Ranges.

Accept-Ranges: indicate whether the server supports the specified range requests and what type of segmentation request

Content-Range: bytes in the present position of the body parts of the overall return, because the request is our first 10 bytes of the picture, the value of the Content-Range bytes 0-9 / 1575, the latter image is 1575 total The number of bytes.

Another method

wget -S http://www.baidu.com/img/bdlogo.gif 2>&1 | grep 'Accept-Ranges'

If you can see the output Accept-Ranges, indicates that the server supports HTTP, or do not support.

Nginx HTTP server enabled by default, and no need to do any additional configuration.

Guess you like

Origin www.cnblogs.com/52py/p/10966801.html