feat(server): add an option to disable adding the `DATE` header
Add an option to disable the automatic addition of the DATE header for
situations when an accurate time is not available or the DATE header
is otherwise undesirable, for example communicating with a non-compliant
client.
According to RFC7231#7.1.1.2, '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.' Otherwise, sending the date is required.
Resolve the now closed issue hyperium#912.
Thanks for the PR! I think providing this is probably a good idea... Do you have a use case that needs this now?
Thanks for the PR! I think providing this is probably a good idea... Do you have a use case that needs this now?
@seanmonstar i need this. when i use http proxy server (like nginx), i need not response the DATE header from hyper. The date header is not required for inter-application communication. This may improve performance.
@NateLing Thank you, I was looking for this. After trying it out, the performance improved on low-end systems as expected. I added a comment to your changes, it is just an idea about the wording of the option. Let me know what you think.
Hello, I would really like for this option to be added. Is there anything blocking this? If so maybe I can help.
I think this just got forgotten. Looking it over, it seems like a fine addition. I think:
- Perhaps it could be publicly called
auto_date()? - Resolve conflicts.
- Add to 0.14.x and to master.
any news on this?
This is a must have configuration. For small payloads, having vs not-having the date header can make a massive difference in performance > 100%. Would love to have this merged 🙏
This would also be useful when using as an HTTP Proxy. After a CONNECT request not all clients expect the Date header.
This would also be useful when using as an HTTP Proxy. After a CONNECT request not all clients expect the Date header.
agree
It was a mistake to forget this. I'd merge it if someone wants to update it to current master.
@seanmonstar will do
@takkuumi @realtimetodie @Black-Hack @darren-fu @tusharmath @RyanAD @deatondg I have proposed a pull request which enables this functionality: #3644. If you could please leave feedback on the API and integration (any suggestions or comments)!