w3c / baggage

Propagation format for distributed context: Baggage
https://w3c.github.io/baggage/
Other
47 stars 18 forks source link

Baggage value clarification for parsing #77

Closed srikanthccv closed 2 years ago

srikanthccv commented 2 years ago

Baggage value difinition

A value contains a URL encoded UTF-8 string. Leading and trailing whitespaces (OWS) are allowed but MUST be trimmed when converting the header into a data structure.

Note, value MAY contain any number of the equal sign (=) characters. Parsers MUST NOT assume that the equal sign is only used to separate key and value.

If value is utf-8 URL encoded, isn't it redundant to say that parsers must not assume there are more than one equal sign?

dyladan commented 2 years ago

If value is utf-8 URL encoded, isn't it redundant to say that parsers must not assume there are more than one equal sign?

It doesn't say parsers must not assume there is more than one equal sign. It says they must not assume there is only one equal sign. In any case, yes that is technically redundant. It is simply a warning that the naive parse like this will not work:

const parts = header.split(',');
const entries = parts.map(e => e.split('=')); // this is broken because values may contain `=`