Subject: [apps-discuss] Question about RFC 7239

From: "[email-masked]" <[email-masked]>
Date: Sun, 28 Aug 2016 21:50:02 +0200 (CEST)

Hello,
I have a question about the "Forwarded" HTTP header field, defined in section 4 of RFC 7239.
The ABNF definition for the header field value is:

Forwarded   = 1#forwarded-element

forwarded-element =
   [ forwarded-pair ] *( ";" [ forwarded-pair ] )

forwarded-pair = token "=" value
value          = token / quoted-string

token = <Defined in [RFC7230], Section 3.2.6>
quoted-string = <Defined in [RFC7230], Section 3.2.6>

If I'm reading this correctly, an empty forwarded-element or one made of only ";"  is a valid element.
For example these values:

Forwarded: ;
Forwarded: ,;
Forwarded: ;,,

are all valid.

Why is an empty forwarded-element allowed? Wouldn't it be better to use an ABNF definition like this?

Forwarded =
   forwarded-element *( "," forwarded-element )

forwarded-element =
   forwarded-pair *( ";" forwarded-pair )

forwarded-pair = token "=" value
value          = token / quoted-string

token = <Defined in [RFC7230], Section 3.2.6>
quoted-string = <Defined in [RFC7230], Section 3.2.6>

Thank you.

Regards,

Luigi

---

From: Julian Reschke <[email-masked]>
Date: Sun, 28 Aug 2016 22:27:49 +0200

> only ";"  is a valid element.

Nope.

See <https://greenbytes.de/tech/webdav/rfc7230.html#abnf.extension>.

 > ...

Best regards, Julian