couling / WebDAV-Daemon

MIT License
34 stars 7 forks source link

Include a "Last-Modified" header #13

Closed sbluhm closed 3 years ago

sbluhm commented 4 years ago

I noticed, that a "Last-Modified" header is not provided. Applications can use it for caching or other performance reasons. Would be nice to add it. (I will see if I can have a look at it later)

sbluhm commented 4 years ago

A Date header is already included in the current requests and seems to deliver the file's last modified date. From my understanding, the Date header should be the time of the request whereas the last modified date of the file should then go into Last-Modified.

Any opinion on this change?

couling commented 4 years ago

That's a really good spot. RFC 2612 says the Date is the date/time the response was generated similar but not quite the request time. So off the top of my head, the creation of a response can / should set this. Moving the existing definition of Date to Last-Modified and generating a Date header on the fly should be easy enough.

sbluhm commented 4 years ago

14

Date is stored at the beginning of the response assembly and added to the response before being sent out. This change does not impact the static reply pages as they have their own date stored in the message. This timing should be good enough. If anyone reports a negative impact, then the sendResponse function should be extended to accept the date.