Subject: [apps-discuss] R: Re: Question about RFC 7239

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

Thank you Julian but I still don't fully get it.
According to the #rule extension as shown in your link,

"foo , ,bar,"

is a valid value, so I assume that in our case

"; , ,"

is also a valid value as forwarded-element is defined like this

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

My main concern is actually on this definition. Why is forwarded-pair 
optional?

Regards,

Luigi

>----Messaggio originale----
>Da: "Julian Reschke" <[email-masked]>
>Data: 28/08/2016 22.27
>A: "[email-masked]"<[email-masked]>, <[email-masked]>
>Ogg: Re: [apps-discuss] Question about RFC 7239
>
>On 2016-08-28 21:50, [email-masked] wrote:
>> 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.
>
>Nope.
>
>See <https://greenbytes.de/tech/webdav/rfc7230.html#abnf.extension>.
>
> > ...
>
>Best regards, Julian
>

---

From: Matthew Kerwin <[email-masked]>
Date: Mon, 29 Aug 2016 09:22:13 +1000

> forwarded-element = [ forwarded-pair ] *( ";" [ forwarded-pair ] )
​The words in RFC 7230 say a lot more than the ABNF does. If you're
concerned about the parser you should accept "a reasonable number of empty
list elements"; but if you're generating headers you "MUST NOT generate
empty list elements." The question, then, is whether ";" is a valid
forwarded-element.

I believe the intention was to make Forwarded be a list of lists, where the
outer list (joined by commas) is as defined in RFC 7230, and the inner list
(joined by semicolons) has the same semantics for ignoring a reasonable
number of empty elements.

To that end, within a single forwarded-element, this might be acceptable: "
;for=1.2.3.4;;proto=http;" (Although I think you probably shouldn't
generate such a value.)

That said, that's only my reading. If it's the case, I suspect maybe it
wasn't made clear enough in RFC 7239.

> My main concern is actually on this definition. Why is forwarded-pair

​Cheers​
-- 
  Matthew Kerwin
  http://matthew.kerwin.net.au/

---

From: Julian Reschke <[email-masked]>
Date: Mon, 29 Aug 2016 08:33:23 +0200

> My main concern is actually on this definition. Why is forwarded-pair

Ah, now I understand your concern - I was focusing on the HTTP ABNF list 
construct.

Sorry, Julian