close

Curl可以透過檢查Etag
來確認檔案是否修改過
如果沒有則回應304


# curl -I http://192.168.1.168/image/A.jpg
HTTP/1.1 200 OK
Date: Fri, 14 Nov 2014 01:37:28 GMT
Server: Apache/2.2.22 (Ubuntu)
Last-Modified: Wed, 12 Nov 2014 02:35:31 GMT
ETag: "5a-4213-507a03fda82c0"
Accept-Ranges: bytes
Content-Length: 16915
Content-Type: image/jpeg

# curl -I http://192.168.1.168/image/A.jpg --header 'If-None-Match: "5a-4213-507a03fda82c0"'
HTTP/1.1 304 Not Modified
Date: Fri, 14 Nov 2014 01:38:29 GMT
Server: Apache/2.2.22 (Ubuntu)
ETag: "5a-4213-507a03fda82c0"

http://wpcertification.blogspot.tw/2010/08/how-to-enable-etag-in-apache-http.html
Etag在Apache上是由Inode + mtime + Size來產生的

Curl也可以檢查Last-Modified
來確認檔案是否修改過
#curl -I http://192.168.1.168/image/A.jpg -H 'If-Modified-Since: Wed, 12 Nov 2014 02:35:31 GMT'
HTTP/1.1 304 Not Modified
Date: Fri, 14 Nov 2014 01:44:06 GMT
Server: Apache/2.2.22 (Ubuntu)
ETag: "5a-4213-507a03fda82c0"

arrow
arrow
    創作者介紹
    創作者 slinbody 的頭像
    slinbody

    495884965

    slinbody 發表在 痞客邦 留言(0) 人氣()