简体   繁体   English

cURL-在我的浏览器中获得200 OK而不是304

[英]cURL - getting 200 OK instead of a 304 in my browser

I am using cURL to trace HTTP headers. 我正在使用cURL跟踪HTTP标头。
My browser says the resource got a 304 response. 我的浏览器说该资源收到304响应。
In my cURL, I see a 200 OK. 在我的cURL中,我看到200 OK。
Would you know why this could be ? 你知道为什么会这样吗?

"304 Not Modified" means the resource is the same like when the browser requested it before (eg based on modification date or etag). “ 304未修改”表示资源与浏览器之前请求资源时相同(例如,基于修改日期或etag)。

Curl has no cache so it will always request the resource without any "if-modified-since" header (and similar ones) - thus the server will send it together with a "200 OK" statuscode. Curl没有缓存,因此它将始终请求资源而没有任何“ if-modified-since”标头(以及类似的标头),因此服务器会将其与“ 200 OK”状态码一起发送。

304 means Not Modified and is send in response of requests that contain If-Modified-Since header. 304表示未修改,是响应包含If-Modified-Since标头的请求而发送的。 Such header is send by the browser for cached resources, but curl does not send it 浏览器发送此类标头以获取缓存的资源,但是curl不发送它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM