问题
Could anyone explain me why "If modified-Since" doesn't work in my http client...?
I check what I send in httpbin.org:
{
"url": "http://www.httpbin.org/get",
"headers": {
"Content-Length": "",
"Connection": "keep-alive",
"Accept": "*/*",
"Host": "www.httpbin.org",
"If-Modified-Since": "Mon, 12 Nov 2012 18:00:00 GMT",
"Content-Type": ""
},
"args": { },
"origin": "89.70.183.105"
}
But I still get every file. "If-modified-since" simply doesn't work. Maybe it's not implemented in servers? If so, could anyone point me server that has implemented this header? Or explain what I'm doing wrong?
Thanks for help
回答1:
Your request looks correct to me, so I'm guessing that the server you are requesting from is not configured to return 304 (Not Modified)
.
I note that your request does not make it clear what kind of file you're trying to retrieve, but it is typical that servers do not return Not Modified
messages on dynamic content (such as PHP, ASPX, etc), as the server doesn't know if the content has changed or not, since it cannot predict the output of the script.
回答2:
Thank You for Your help!
You can't believe where I had a mistake... In my code I wrote "If-Modified_Since" instead of "If-Modified-Since"...
It's very weird, because httpbin.org/get tell me that I send "If-Modified-Since"...(!!!)
But when my request is for example: "zbcdefghijk" - httpbin.org/get shows me that I sent exactly that header (that not exist of course).
I spent 7 hours looking for my mistake. ;( It was difficult to find because I too much trusted httpbin.org. :(((((
来源:https://stackoverflow.com/questions/13349001/if-modified-since-header