hyper icon indicating copy to clipboard operation
hyper copied to clipboard

feat(server): add an option to disable adding the `DATE` header

Open deatondg opened this issue 3 years ago • 7 comments

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.

deatondg avatar Feb 10 '22 03:02 deatondg

Thanks for the PR! I think providing this is probably a good idea... Do you have a use case that needs this now?

seanmonstar avatar Feb 10 '22 18:02 seanmonstar

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.

takkuumi avatar Mar 07 '22 01:03 takkuumi

@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.

realtimetodie avatar Jul 12 '22 21:07 realtimetodie

Hello, I would really like for this option to be added. Is there anything blocking this? If so maybe I can help.

Black-Hack avatar Mar 15 '23 16:03 Black-Hack

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.

seanmonstar avatar Mar 15 '23 20:03 seanmonstar

any news on this?

darren-fu avatar Nov 07 '23 07:11 darren-fu

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 🙏

tusharmath avatar Nov 09 '23 18:11 tusharmath

This would also be useful when using as an HTTP Proxy. After a CONNECT request not all clients expect the Date header.

RyanAD avatar Apr 11 '24 20:04 RyanAD

This would also be useful when using as an HTTP Proxy. After a CONNECT request not all clients expect the Date header.

agree

darren-fu avatar Apr 12 '24 03:04 darren-fu

It was a mistake to forget this. I'd merge it if someone wants to update it to current master.

seanmonstar avatar Apr 13 '24 12:04 seanmonstar

@seanmonstar will do

edwardwc avatar Apr 22 '24 19:04 edwardwc

@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)!

edwardwc avatar Apr 22 '24 23:04 edwardwc