Jump to content

Http Protocol: What is "Date" for?

¨TrisT¨
Go to solution Solved by cynexit,

Afaik one of the uses is caching, but the field is not mandatory so you can leave it out and every browser should still work fine.

 

Quote

   An origin server MUST NOT send a Date header field if it does not
   have a clock capable of providing a reasonable approximation of the
   current instance in Coordinated Universal Time.  An origin server MAY
   send a Date header field if the response is in the 1xx
   (Informational) or 5xx (Server Error) class of status codes.  An
   origin server MUST send a Date header field in all other cases.

 

Hi!

First off, by date I mean date and time in an http response.

I'm coding a web server in c++ for fun and I'm building a library to help with things I really don't wanna code more than once ever, one of them being the date in a specific format, and others without using ctime directly.

I'm almost done, but now I wonder, what the f* is that for?

I've gone through chrome back and forward and I haven't been able to find anything about any dates, and I tried using an arbitrary one, nothing happened, ofc I wanna do everything right but I'm actually clueless as off to why one would ever need this as it doesn't seem to get registered anywhere in the client side and any decent server could do it internally.

 

Thank you.

Link to comment
Share on other sites

Link to post
Share on other sites

Afaik one of the uses is caching, but the field is not mandatory so you can leave it out and every browser should still work fine.

 

Quote

   An origin server MUST NOT send a Date header field if it does not
   have a clock capable of providing a reasonable approximation of the
   current instance in Coordinated Universal Time.  An origin server MAY
   send a Date header field if the response is in the 1xx
   (Informational) or 5xx (Server Error) class of status codes.  An
   origin server MUST send a Date header field in all other cases.

 

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, cynexit said:

Afaik one of the uses is caching, but the field is not mandatory so you can leave it out and every browser should still work fine.

 

 

Thx! :D

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×