curl -sIX HEAD 二进制文件
#!/bin/bash
HEAD=`curl -sIX HEAD http://gert.iriscouch.com/www/test`
echo "$HEAD"
if [[ $HEAD =~ Etag:\ \"(.*)\" ]]; then
echo "${BASH_REMATCH[1]}"
fi
HEAD=`curl -sIX HEAD http://gert.iriscouch.com/www/test/user.png`
echo "$HEAD"
if [[ $HEAD =~ Etag:\ \"(.*)\" ]]; then
echo "${BASH_REMATCH[1]}"
fi
在第二个 HEAD 上它与 Etag 不匹配?
HTTP/1.1 200 OK
Server: CouchDB/1.1.0 (Erlang OTP/R14B03)
Etag: "2-bd7278b9cc8b0ddaf7c863102f42f246"
Date: Thu, 01 Sep 2011 19:47:02 GMT
Content-Type: text/plain;charset=utf-8
Content-Length: 207
Cache-Control: must-revalidate
2-bd7278b9cc8b0ddaf7c863102f42f246
HTTP/1.1 200 OK
Server: CouchDB/1.1.0 (Erlang OTP/R14B03)
ETag: "2-bd7278b9cc8b0ddaf7c863102f42f246"
Date: Thu, 01 Sep 2011 19:47:03 GMT
Content-Type: image/png
Content-MD5: SS+3YnbRbRQ4uiJKcnFkdA==
Content-Length: 4003
Cache-Control: must-revalidate
Accept-Ranges: bytes
#!/bin/bash
HEAD=`curl -sIX HEAD http://gert.iriscouch.com/www/test`
echo "$HEAD"
if [[ $HEAD =~ Etag:\ \"(.*)\" ]]; then
echo "${BASH_REMATCH[1]}"
fi
HEAD=`curl -sIX HEAD http://gert.iriscouch.com/www/test/user.png`
echo "$HEAD"
if [[ $HEAD =~ Etag:\ \"(.*)\" ]]; then
echo "${BASH_REMATCH[1]}"
fi
On the second HEAD it does not match the Etag?
HTTP/1.1 200 OK
Server: CouchDB/1.1.0 (Erlang OTP/R14B03)
Etag: "2-bd7278b9cc8b0ddaf7c863102f42f246"
Date: Thu, 01 Sep 2011 19:47:02 GMT
Content-Type: text/plain;charset=utf-8
Content-Length: 207
Cache-Control: must-revalidate
2-bd7278b9cc8b0ddaf7c863102f42f246
HTTP/1.1 200 OK
Server: CouchDB/1.1.0 (Erlang OTP/R14B03)
ETag: "2-bd7278b9cc8b0ddaf7c863102f42f246"
Date: Thu, 01 Sep 2011 19:47:03 GMT
Content-Type: image/png
Content-MD5: SS+3YnbRbRQ4uiJKcnFkdA==
Content-Length: 4003
Cache-Control: must-revalidate
Accept-Ranges: bytes
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
情况有所不同。
使用
我希望这有帮助
The case is different.
use
I hope this helps
来自 http://www.w3.org/Protocols/rfc2616/ rfc2616-sec4.html#sec4.2
该错误存在于您的代码中,“ETAG”、“etag”、“ETag”和“Etag”都是标头值的同等有效表达式。
但是,我在下一个版本 (1.2) 中更改了 CouchDB,以按照“严格发送内容”原则一致使用“ETag”。
From http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2
The bug is in your code, 'ETAG', 'etag', 'ETag' and 'Etag' are all equally valid expressions of the header value.
However, I have changed CouchDB in the next release (1.2) to consistently use 'ETag' on the 'be strict in what you send' principle.