[tarantool-patches] Re: [PATCH v1 1/1] http: fix httpc auto-managed headers
Kirill Shcherbatov
kshcherbatov at tarantool.org
Thu Mar 7 17:07:04 MSK 2019
>> + /*
>> + * 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);
}
More information about the Tarantool-patches
mailing list