[tarantool-patches] Re: [PATCH v1 1/1] http: fix httpc auto-managed headers
Vladimir Davydov
vdavydov.dev at gmail.com
Thu Mar 7 17:32:20 MSK 2019
On Thu, Mar 07, 2019 at 05:07:04PM +0300, Kirill Shcherbatov wrote:
> >> + /*
> >> + * The sequence of managed headers must be sorted to
> >> + * stop scan when strcasecmp < 0. The header is expected
> >> + * to be formated with "%s: %s" pattern, so direct size
> >> + * verification is redundant.
> >> + */
> >> + struct {
> >> + const char *name;
> >> + int len;
> >> + } managed_headers[] = {
> >> + {"Accept: ", sizeof("Accept: ") - 1},
> >> + {"Connection: ", sizeof("Connection: ") - 1},
> >> + {"Content-Length: ", sizeof("Content-Length: ") - 1},
> >> + {"Keep-Alive: ", sizeof("Keep-Alive: ") - 1},
> >
> > - A space after a colon (:) isn't mandatory according to the http
> > protocol, e.g. "content-length:10" is a valid header.
> All headers are formated by server earlier, so this is acceptable:
> if (httpc_set_header(req, "%s: %s",
> lua_tostring(L, -2),
> lua_tostring(L, -1)) < 0) {
> httpc_request_delete(req);
> return luaT_error(L);
> }
Yeah, okay, but looks kinda fragile if you consider the httpc module on
its own, without looking at the Lua binding code. So please change.
More information about the Tarantool-patches
mailing list