ietf-wg-httpapi / ratelimit-headers

Repository for IETF WG draft ratelimit-headers
Other
45 stars 5 forks source link

Added support for policy identifier #130

Closed darrelmiller closed 1 month ago

darrelmiller commented 1 year ago

This proposal takes what we currently have in draft-07

RateLimit-Policy: 100;w=60, 10000;w=86400
{ 50 requests and 30 seconds}
RateLimit: limit=100, remaining=50, reset=30  // protection limit
{ 1 requests and 40 seconds}
RateLimit: limit=10000, remaining=90, reset=200 // quota limit

and suggests the following alternative

RateLimit-Policy: protection;l=100;w=60, quota;l=10000;w=86400
{ 50 requests and 30 seconds}
RateLimit: protection;r=50;t=30
{ 1 request and 40 seconds}
RateLimit: quota;r=90;t=200

This proposal introduces a policy "identifier" that connects the RateLimit field to the RateLimit-Policy field. The primary purpose is to address #127.

With the change in draft-07 to use structured fields in the header we now have the opportunity to explore different approaches and features without trying to maintain similarity with past efforts.

nfriedly commented 1 year ago

I'm a big fan of this overall, I think it's a solid improvement in terms of consistency and ease of parsing.

I am curious about the reasoning for separate RateLimit and RateLimit-Policy headers? It seems to me that the policy parameters could also be appended to the RateLimit header.

darrelmiller commented 10 months ago

I am curious about the reasoning for separate RateLimit and RateLimit-Policy headers? It seems to me that the policy parameters could also be appended to the RateLimit header.

The split is due to variability of the values and HTTP/2 HPACK compression. RateLimit-Policy should rarely change and therefore can be optimized by header compression. RateLimit will change on ever request and therefore will not be optimized.

ioggstream commented 10 months ago

make returns this error.

draft-ietf-httpapi-ratelimit-headers.xml(0): Error: IDREF attribute target references an unknown ID "ratelimit-reset-keyword", at None

ioggstream commented 10 months ago

@darrelmiller I tried to fix the broken section references: now it should build. Could you please PTAL?

ioggstream commented 10 months ago

@nfriedly PR welcome for fixing inconsistencies :)

richsalz commented 10 months ago

make returns this error.

draft-ietf-httpapi-ratelimit-headers.xml(0): Error: IDREF attribute target references an unknown ID "ratelimit-reset-keyword", at None

There's a few instances still to be cleaned up:

; grep -n ratelimit-reset-keyword *.md
draft-ietf-httpapi-ratelimit-headers.md:216:     the time window reset time ({{ratelimit-reset-keyword}}).
draft-ietf-httpapi-ratelimit-headers.md:233:- inferred by the value of the [reset keyword](#ratelimit-reset-keyword) at the moment of the reset, or
draft-ietf-httpapi-ratelimit-headers.md:263:## Reset Keyword {#ratelimit-reset-keyword}
draft-ietf-httpapi-ratelimit-headers.md:440:Consider that service limit might not be restored after the moment referenced by the [reset keyword](#ratelimit-reset-keyword),
draft-ietf-httpapi-ratelimit-headers.md:579:| RateLimit | reset                 | Dictionary Key |Quota reset interval | {{ratelimit-reset-keyword}} of {{&SELF}} |       |