From: Roman Khabibov via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: Alexander Turenko <alexander.turenko@tarantool.org>, Leonid Vasiliev <lvasiliev@tarantool.org> Cc: tarantool-patches@dev.tarantool.org Subject: Re: [Tarantool-patches] [PATCH 1/2] build: enable smtp Date: Fri, 9 Apr 2021 22:55:11 +0300 [thread overview] Message-ID: <4BE31DD9-5C47-457C-B0F9-8D8826276B88@tarantool.org> (raw) In-Reply-To: <20210330231354.vm2emlswu77wpuys@tkn_work_nb> Hi! Thanks for the review. > On Mar 31, 2021, at 02:13, Alexander Turenko <alexander.turenko@tarantool.org> wrote: > > Aside of several stylistic nits, I have no objections. > > LGTM after changes (no need to re-review with me.) > > Please, update and proceed with the next reviewer. > > On Fri, Mar 19, 2021 at 04:45:54PM +0300, Roman Khabibov wrote: >> Enable smtp protocol in bundled libCURL. > > Nit: Regarding 'libCURL'. The project page ([1]) name the library > 'libcurl', so it would be better to follow it. Done. > [1]: https://curl.se/libcurl/ > > Please, leave a couple of words why the change is needed and link the > relevant issue. I see that > https://github.com/tarantool/tarantool/issues/4559 is quite relevant. > >> +## feature/build >> + >> +* Enable smtp protocol in bundled libCURL (gh-####). > > Nit: 'gh-####' have no any sense. It is better to replace it with gh-4559. > >> \ No newline at end of file > > No newline at end of file. Added. >> diff --git a/cmake/BuildLibCURL.cmake b/cmake/BuildLibCURL.cmake >> index 39a1d62fd..59f78d9e2 100644 >> --- a/cmake/BuildLibCURL.cmake >> +++ b/cmake/BuildLibCURL.cmake >> @@ -77,7 +77,7 @@ macro(curl_build) >> >> # Switch off the group of protocols with special flag HTTP_ONLY: >> # ftp, file, ldap, ldaps, rtsp, dict, telnet, tftp, pop3, imap, smtp. >> - list(APPEND LIBCURL_CMAKE_FLAGS "-DHTTP_ONLY=ON") >> + list(APPEND LIBCURL_CMAKE_FLAGS "-DHTTP_ONLY=OFF") >> >> # Additionaly disable some more protocols. >> list(APPEND LIBCURL_CMAKE_FLAGS "-DCURL_DISABLE_SMB=ON") >> @@ -142,7 +142,7 @@ macro(curl_build) >> list(APPEND LIBCURL_CMAKE_FLAGS "-DCURL_DISABLE_TFTP=ON") >> list(APPEND LIBCURL_CMAKE_FLAGS "-DCURL_DISABLE_POP3=ON") >> list(APPEND LIBCURL_CMAKE_FLAGS "-DCURL_DISABLE_IMAP=ON") >> - list(APPEND LIBCURL_CMAKE_FLAGS "-DCURL_DISABLE_SMTP=ON") >> + list(APPEND LIBCURL_CMAKE_FLAGS "-DCURL_DISABLE_SMTP=OFF") > > I made the following checks: > > 1. Compared build/curl/work/curl/CMakeCache.txt before and after the > change. Only given options are changed. Okay. > > 2. Added the following hunk to test/box-tap/curl-build.test.lua: > > | local i = 0 > | local protocol = info.protocols[i] > | while protocol ~= nil do > | print(('protocols[%d] = %s'):format(i, ffi.string(protocol))) > | i = i + 1 > | protocol = info.protocols[i] > | end > > Before the patch: > > | protocols[0] = http > | protocols[1] = https > > After the patch: > > | protocols[0] = http > | protocols[1] = https > | protocols[2] = smtp > | protocols[3] = smtps > > (See, it worth to check for smtps as well.) > > The output looks okay. > > 3. Added the following hunk to test/box-tap/curl-build.test.lua: > > | print(('features: %d'):format(info.features)) > > The output before and after the patch is the same: > > | features: 2622093 > > Looks okay. > > So, it seems, we don't enable or disable something unintentionally. > Nice. > >> +-- >> +-- gh-####: Check if smtp protocol is enabled. >> +-- > > Nit: Please, replace with gh-4559. > >> +local function has_smtp() >> + local i = 0 >> + -- curl_version_info_data.protocols is a null terminated array >> + -- of pointers to char. >> + -- See curl/lib/version.c: >> + -- static const char * const protocols[] >> + local protocol = info.protocols[i] >> + while protocol ~= nil do >> + if ffi.string(protocol) == 'smtp' then >> + return true >> + end > > It worth to check for 'smtps' as well (see above). +local function has_protocol(protocol_str) + local i = 0 + -- curl_version_info_data.protocols is a null terminated array + -- of pointers to char. + -- See curl/lib/version.c: + -- static const char * const protocols[] + local info = ffi.C.curl_version_info(7) + local protocol = info.protocols[i] + while protocol ~= nil do + if ffi.string(protocol) == protocol_str then + return true + end + i = i + 1 + protocol = info.protocols[i] + end + + return false +end + +-- +-- gh-4559: check if smtp and smtps protocols are enabled. +-- +test:ok(has_protocol('smtp'), 'smtp protocol is supported') +test:ok(has_protocol('smtps'), 'smtps protocol is supported’) + commit 4d939d2ac120774af29f2dc1fd5dd1528f82fce8 Author: Roman Khabibov <roman.habibov@tarantool.org> Date: Tue Jan 19 00:45:32 2021 +0300 build: enable smtp Enable smtp and smtps protocols in bundled libcurl. Part of #4559 diff --git a/changelogs/unreleased/enable-smtp.md b/changelogs/unreleased/enable-smtp.md new file mode 100755 index 000000000..aa299b3c2 --- /dev/null +++ b/changelogs/unreleased/enable-smtp.md @@ -0,0 +1,3 @@ +## feature/build + +* Enable smtp and smtps protocols in bundled libcurl (gh-4559). diff --git a/cmake/BuildLibCURL.cmake b/cmake/BuildLibCURL.cmake index 39a1d62fd..59f78d9e2 100644 --- a/cmake/BuildLibCURL.cmake +++ b/cmake/BuildLibCURL.cmake @@ -77,7 +77,7 @@ macro(curl_build) # Switch off the group of protocols with special flag HTTP_ONLY: # ftp, file, ldap, ldaps, rtsp, dict, telnet, tftp, pop3, imap, smtp. - list(APPEND LIBCURL_CMAKE_FLAGS "-DHTTP_ONLY=ON") + list(APPEND LIBCURL_CMAKE_FLAGS "-DHTTP_ONLY=OFF") # Additionaly disable some more protocols. list(APPEND LIBCURL_CMAKE_FLAGS "-DCURL_DISABLE_SMB=ON") @@ -142,7 +142,7 @@ macro(curl_build) list(APPEND LIBCURL_CMAKE_FLAGS "-DCURL_DISABLE_TFTP=ON") list(APPEND LIBCURL_CMAKE_FLAGS "-DCURL_DISABLE_POP3=ON") list(APPEND LIBCURL_CMAKE_FLAGS "-DCURL_DISABLE_IMAP=ON") - list(APPEND LIBCURL_CMAKE_FLAGS "-DCURL_DISABLE_SMTP=ON") + list(APPEND LIBCURL_CMAKE_FLAGS "-DCURL_DISABLE_SMTP=OFF") include(ExternalProject) ExternalProject_Add( diff --git a/test/box-tap/gh-5223-curl-exports.test.lua b/test/box-tap/curl-build.test.lua similarity index 88% rename from test/box-tap/gh-5223-curl-exports.test.lua rename to test/box-tap/curl-build.test.lua index 300d60b07..ae0d397b5 100755 --- a/test/box-tap/gh-5223-curl-exports.test.lua +++ b/test/box-tap/curl-build.test.lua @@ -56,7 +56,7 @@ ffi.cdef([[ local info = ffi.C.curl_version_info(7) local test = tap.test('curl-features') -test:plan(3) +test:plan(5) if test:ok(info.ssl_version ~= nil, 'Curl built with SSL support') then test:diag('ssl_version: ' .. ffi.string(info.ssl_version)) @@ -78,6 +78,9 @@ else RTLD_DEFAULT = ffi.cast("void *", 0LL) end +-- +-- gh-5223: Check if all curl symbols are exported. +-- -- The following list was obtained by parsing libcurl.a static library: -- nm libcurl.a | grep -oP 'T \K(curl_.+)$' | sort local curl_symbols = { @@ -174,4 +177,29 @@ test:test('curl_symbols', function(t) end end) +local function has_protocol(protocol_str) + local i = 0 + -- curl_version_info_data.protocols is a null terminated array + -- of pointers to char. + -- See curl/lib/version.c: + -- static const char * const protocols[] + local info = ffi.C.curl_version_info(7) + local protocol = info.protocols[i] + while protocol ~= nil do + if ffi.string(protocol) == protocol_str then + return true + end + i = i + 1 + protocol = info.protocols[i] + end + + return false +end + +-- +-- gh-4559: check if smtp and smtps protocols are enabled. +-- +test:ok(has_protocol('smtp'), 'smtp protocol is supported') +test:ok(has_protocol('smtps'), 'smtps protocol is supported') + os.exit(test:check() and 0 or 1)
next prev parent reply other threads:[~2021-04-09 19:56 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-03-19 13:45 [Tarantool-patches] [PATCH 0/2] Install curl headers and " Roman Khabibov via Tarantool-patches 2021-03-19 13:45 ` [Tarantool-patches] [PATCH 1/2] build: " Roman Khabibov via Tarantool-patches 2021-03-30 23:13 ` Alexander Turenko via Tarantool-patches 2021-04-09 19:55 ` Roman Khabibov via Tarantool-patches [this message] 2021-04-12 10:01 ` Leonid Vasiliev via Tarantool-patches 2021-03-19 13:45 ` [Tarantool-patches] [PATCH 2/2] build: install libCURL headers Roman Khabibov via Tarantool-patches 2021-03-30 23:14 ` Alexander Turenko via Tarantool-patches 2021-04-09 19:55 ` Roman Khabibov via Tarantool-patches 2021-04-12 13:14 ` Leonid Vasiliev via Tarantool-patches 2021-04-15 0:28 ` [Tarantool-patches] [PATCH 0/2] Install curl headers and enable smtp Alexander Turenko via Tarantool-patches
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=4BE31DD9-5C47-457C-B0F9-8D8826276B88@tarantool.org \ --to=tarantool-patches@dev.tarantool.org \ --cc=alexander.turenko@tarantool.org \ --cc=lvasiliev@tarantool.org \ --cc=roman.habibov@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH 1/2] build: enable smtp' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox