]> git.ipfire.org Git - thirdparty/FORT-validator.git/commit
Patch TODO: Initialize only one CURL per thread
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Wed, 29 Dec 2021 23:31:08 +0000 (17:31 -0600)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Wed, 29 Dec 2021 23:31:08 +0000 (17:31 -0600)
commit3c01104b60c0695902ac250d931e6cc7f000f577
treeb36d08f5038650335e42e94478590e888084808a
parent8e073c2973552381594930fc802454853a899d97
Patch TODO: Initialize only one CURL per thread

Fort was reinitializing the CURL object on every HTTP download.
libcurl's documentation recommends against this:

You need one handle for each easy session you want to perform.
Basically, you should use one handle for every thread you plan to
use for transferring.

(...)

If you then want to transfer another file, the handle is ready to be
used again. Mind you, it is even preferred that you re-use an
existing handle if you intend to make another transfer. libcurl will
then attempt to re-use the previous connection.

The CURL was moved to the thread state variable, is initialized once per
thread, per validation cycle, and is employed in every HTTP transfer.
src/http/http.c
src/http/http.h
src/state.c
src/state.h