Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 2 commits into from

Conversation

deatondg
Copy link

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 #912.

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.
@seanmonstar
Copy link
Member

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

@takkuumi
Copy link

takkuumi commented Mar 7, 2022

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.

@realtimetodie
Copy link

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

@Black-Hack
Copy link

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

@seanmonstar
Copy link
Member

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.

@darren-fu
Copy link

any news on this?

@tusharmath
Copy link

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 🙏

@RyanAD
Copy link

RyanAD commented Apr 11, 2024

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

@darren-fu
Copy link

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

agree

@seanmonstar
Copy link
Member

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

@edwardwc
Copy link
Contributor

@seanmonstar will do

@edwardwc
Copy link
Contributor

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

@Black-Hack
Copy link

I think this issue can be closed now, since #3644 is merged. Thank you @edwardwc and @seanmonstar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants