PHP header HTTP 1.0 vs 1.1 [duplicate]
Possibl开发者_Python百科e Duplicate:
404 header - HTTP 1.0 or 1.1?
Should you use
header( "HTTP/1.0 404 Not Found", true, 404 );
instead of
header( "HTTP/1.1 404 Not Found", true, 404 );
when the user agent uses HTTP/1.0? That is, is it good to reply with the same HTTP version?
Btw, I'm using it to claim that a page doesn't exist to users currently not logged in. I understand that it is different versions and that HTTP/1.1 has different functions.
When the user agent says it uses HTTP 1.0 (specified in RFC 1945 dated May 1996) you should not assume that it understands a protocol that was developed later (like HTTP 1.1 specified in RFC 2616 dated June 1999). So use HTTP 1.0 in the reply.
If you don't want to distinguish between 1.0 and 1.1 and want to send a static header, I guess
header( "HTTP/1.0 404 Not Found", true, 404 );
is the safe way to do it - every client speaks HTTP/1.0.
But I also expect that no client at all checks the http version in case of a 404. At least, I never experienced problems with the http version...
精彩评论