[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: luasocket: HTTP and multiple headers
- From: Matthew Wild <mwild1@...>
- Date: Mon, 13 Feb 2012 14:49:42 +0100
On 13 February 2012 12:48, Vladimir Dronnikov <firstname.lastname@example.org> wrote:
> LuaSocket HTTP responses concatenate same-named headers using commas.
> This makes it practically impossible to reliably split them later in
> application logic.
Unfortunately it is well within its rights to do so. The HTTP
specification clearly states that multiple headers are equal to
> Consider vanilla use case: server sets multiple
Yes, Set-Cookie. A few implementations quote the date in Expires, but
I don't believe that practice is widespread. Still, it's not
*impossible* to parse - you just have to treat the date as everything
between Expires= and the next ';' .
> I see two straight ways to fix that: either to report array-like
> tables for same-named headers, or concat using a nonce, which itself
> is reported as a key to returned response table.
Yes, this would be sensible. However I still see the possibilities of
applications then expecting an array, and then a HTTP server or proxy
sending a comma-separated list in a single header (proxies can and
will do this). Therefore it still requires knowledge (that LuaSocket
doesn't have) of whether a particular header is a list or not.
> Or, how else this problem is solved?
Backwards compatibility with the internet is fun :)