From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Subject: Re: [tarantool-patches] Re: [PATCH v1 1/1] http: fix httpc auto-managed headers References: <9099f8a339c278e3a5dac683923d13c7ee470ce9.1550761676.git.kshcherbatov@tarantool.org> <80130a1b-84ad-5f90-9422-95bb0a1e67cb@tarantool.org> <998b800b-acc1-f0c8-1fd3-322d0c04f657@tarantool.org> <20190307135135.dner6r66szejw6lx@esperanza> From: Kirill Shcherbatov Message-ID: <607fe6de-8db7-d379-a2f7-888f602796b5@tarantool.org> Date: Thu, 7 Mar 2019 17:07:04 +0300 MIME-Version: 1.0 In-Reply-To: <20190307135135.dner6r66szejw6lx@esperanza> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit To: Vladimir Davydov , Tarantool MailList List-ID: >> + /* >> + * 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); }