- From: Willy Tarreau <w@1wt.eu>
- Date: Tue, 12 Jul 2016 05:22:37 +0200
- To: Yanick Rochon <yanick.rochon@gmail.com>
- Cc: Julian Reschke <julian.reschke@gmx.de>, Poul-Henning Kamp <phk@phk.freebsd.dk>, Phil Hunt <phil.hunt@oracle.com>, HTTP Working Group <ietf-http-wg@w3.org>
On Mon, Jul 11, 2016 at 03:47:32PM -0400, Yanick Rochon wrote:
> On 11 July 2016 at 15:25, Willy Tarreau <w@1wt.eu> wrote:
>
> > On Mon, Jul 11, 2016 at 09:11:09PM +0200, Julian Reschke wrote:
> >
> > OK thanks for explaining. But then what situation could lead to this
> > confusing object to be emitted ? I thought that it was only related to
> > posting multiple headers in which case I don't see the issue if we
> > consider that all these headers are lists, and are then concatenated
> > by the recipient.
> >
> >
> If, for example, a sender sends a request such as
>
> { ..., "Accept":
> "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5",
> ..., "Accept": "text/plain;q=0.9", ... }
>
> through a clumsy string concatenation, what is the suggested behavior?
For me it means it sent two values for the Accept header defined as a list,
the first one being "appliation/xml...", and the second one "text/plain...".
I'm having an issue with the representation above though (and maybe I missed
certain things recently), because my understanding of JSON headers till now
was that one would send :
{ "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5" }
as the value of the first Accept header field, then
{ "text/plain;q=0.9" }
as the value of the second Accept header field.
And it's the recipient which would then decide to make a list of it because
we'd specifiy that each JSON-encoded header is a clearly defined list, so on
first header received it would do something like this (I'm not 100% sure about
the syntax as I'm not good at JSON) :
{ "Accept": {
"application/xml", "application/xhtml+xml", "text/html;q=0.9",
"text/plain;q=0.8", "image/png", "*/*;q=0.5" } }
Then when receiving the second header, it would simply append its value to
the list :
{ "Accept": {
"application/xml", "application/xhtml+xml", "text/html;q=0.9",
"text/plain;q=0.8", "image/png", "*/*;q=0.5", "text/plain;q=0.9" } }
Since it seams easy to me I'm having an issue understanding the deeper
problem and am pretty sure I missed something :-/
Regards,
Willy
Received on Tuesday, 12 July 2016 03:23:21 UTC