lua-users home
lua-l archive

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


Hi!

LuaSocket HTTP responses concatenate same-named headers using commas.
This makes it practically impossible to reliably split them later in
application logic. Consider vanilla use case: server sets multiple
Set-Cookie:

```
Set-Cookie: foo=foo;Expires=Jan 1, 2012
Set-Cookie: bar=bar;Expires=Jan 2, 2012
```

The corresponding response headers table contains:

```
['set-cookie'] = "foo=foo;Expires=Jan 1, 2012, bar=bar;Expires=Jan 2, 2012"
```

and splitting with ',' gives false positives.

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.

Or, how else this problem is solved?

TIA,
--Vladimir Dronnikov, dvv at github.com