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

support HTTPDate in Retry-After header #138

Merged
merged 6 commits into from
May 9, 2024

Conversation

justenwalker
Copy link
Contributor

@justenwalker justenwalker commented Aug 9, 2021

According to RFC7231
the Retry-After header may be specified in both number of seconds OR an HTTPDate

The value of this field can be either an HTTP-date or a number of seconds to delay after the response is received.

   Retry-After = HTTP-date / delay-seconds

A delay-seconds value is a non-negative decimal integer, representing time in seconds.

   delay-seconds  = 1*DIGIT

Two examples of its use are

  Retry-After: Fri, 31 Dec 1999 23:59:59 GMT
  Retry-After: 120

This change adds support for parsing the date if the format of the header contains non-numeric characters

Closes: #144

@hashicorp-cla
Copy link

hashicorp-cla commented Aug 9, 2021

CLA assistant check
All committers have signed the CLA.

@justenwalker justenwalker force-pushed the support-retryafter-date branch from ea16331 to 2cbfe34 Compare August 9, 2021 17:20
According to [RFC7231](https://httpwg.org/specs/rfc7231.html#header.retry-after)
the Retry-After header may be specified in both number of seconds OR an HTTPDate

>  The value of this field can be either an HTTP-date or a number of seconds to delay after the response is received.
>
>        Retry-After = HTTP-date / delay-seconds
>
>  A delay-seconds value is a non-negative decimal integer, representing time in seconds.
>
>        delay-seconds  = 1*DIGIT
>
>  Two examples of its use are
>
>       Retry-After: Fri, 31 Dec 1999 23:59:59 GMT
>       Retry-After: 120

This change adds support for parsing the date if the format of the header contains non-numeric characters
@justenwalker justenwalker force-pushed the support-retryafter-date branch from 2cbfe34 to e16f958 Compare August 12, 2021 21:51
@justenwalker justenwalker force-pushed the support-retryafter-date branch from 8b0038a to badefbb Compare August 13, 2021 15:47
Removes dependency on regular expressions for detecting numeric header
values vs date values
@justenwalker justenwalker force-pushed the support-retryafter-date branch from badefbb to f2396f0 Compare August 13, 2021 15:54
@palczyn
Copy link

palczyn commented Sep 20, 2021

Hi, I have seen a few pull requests like this that are updated whenever the last pull request have conflicts with current version. Can Hashicorp add this functionality, please?

@justenwalker
Copy link
Contributor Author

I opened #144 for discussion about the feature. Given that there are now 3 PRs that accomplish the same thing, we should probably consolidate discussion in a single place.

@justenwalker justenwalker requested a review from a team as a code owner May 9, 2024 13:29
Copy link
Contributor

@manicminer manicminer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@justenwalker Thanks for submitting this PR! Although there are a few open PRs aiming to add this functionality, this feels like the cleanest and most robust implementation. As such I'll merge this for inclusion in an upcoming release. Thanks again.

@manicminer manicminer added this to the v0.7.6 milestone May 9, 2024
@manicminer manicminer merged commit 7fab210 into hashicorp:main May 9, 2024
1 check passed
manicminer added a commit that referenced this pull request May 9, 2024
manicminer added a commit that referenced this pull request May 9, 2024
manicminer added a commit that referenced this pull request May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support RFC1123 Date/Time in Retry-After header
4 participants