lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

maybe using a NUL char is better ?

2012/2/13 Matthew Wild <>:
> On 13 February 2012 12:48, Vladimir Dronnikov <> wrote:
>> Hi!
>> 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
> comma-separated lists[1].
>> Consider vanilla use case: server sets multiple
>> Set-Cookie:
> 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 ';' [2].
>> 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 :)
> Regards,
> Matthew
> [1]:
> [2]: