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"
- Nov 14 Fri 2014 09:41
Curl If-None-Match vs If-Modified-Since
close
文章標籤
全站熱搜
留言列表