From 2d50bdb6fa5073e23649f391fe834f02998b7580 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Wed, 16 Nov 2016 15:53:52 +0300 Subject: [PATCH 1/9] Add. Support cURL 7.51.0 --- appveyor.yml | 2 +- src/lcerr_easy.h | 3 +++ src/lcopteasy.h | 5 ++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 3de24b5..dbf2739 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,7 +7,7 @@ shallow_clone: true environment: LUAROCKS_VER: 2.2.1 - CURL_VER: 7.50.1 + CURL_VER: 7.51.0 matrix: - LUA_VER: 5.1.5 diff --git a/src/lcerr_easy.h b/src/lcerr_easy.h index 3c8cd4c..abde23e 100644 --- a/src/lcerr_easy.h +++ b/src/lcerr_easy.h @@ -9,6 +9,9 @@ ERR_ENTRY ( COULDNT_RESOLVE_PROXY ) ERR_ENTRY ( COULDNT_RESOLVE_HOST ) ERR_ENTRY ( COULDNT_CONNECT ) ERR_ENTRY ( FTP_WEIRD_SERVER_REPLY ) +#if LCURL_CURL_VER_GE(7,51,0) +ERR_ENTRY ( WEIRD_SERVER_REPLY ) +#endif ERR_ENTRY ( REMOTE_ACCESS_DENIED ) #if LCURL_CURL_VER_GE(7,31,0) ERR_ENTRY ( FTP_ACCEPT_FAILED ) diff --git a/src/lcopteasy.h b/src/lcopteasy.h index e6d4773..1d8771c 100644 --- a/src/lcopteasy.h +++ b/src/lcopteasy.h @@ -348,6 +348,10 @@ OPT_ENTRY( tcp_fastopen, TCP_FASTOPEN, LNG, 0, LCUR OPT_ENTRY( connect_to, CONNECT_TO, LST, 0, LCURL_DEFAULT_VALUE ) #endif +#if LCURL_CURL_VER_GE(7,51,0) +OPT_ENTRY( keep_sending_on_error, KEEP_SENDING_ON_ERROR, LNG, 0, LCURL_DEFAULT_VALUE ) +#endif + #ifdef OPT_ENTRY_IS_NULL # undef OPT_ENTRY #endif @@ -355,4 +359,3 @@ OPT_ENTRY( connect_to, CONNECT_TO, LST, 0, LCUR #ifdef FLG_ENTRY_IS_NULL # undef FLG_ENTRY #endif - From 83de1e1d2f5a8c31956c7786388eefbb6e09bcf4 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Wed, 16 Nov 2016 16:17:10 +0300 Subject: [PATCH 2/9] Use hererocks. --- appveyor.yml | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index dbf2739..c0fbb05 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,32 +6,38 @@ os: shallow_clone: true environment: - LUAROCKS_VER: 2.2.1 + LR_EXTERNAL: c:\external CURL_VER: 7.51.0 matrix: - - LUA_VER: 5.1.5 - - LUA_VER: 5.2.4 - - LUA_VER: 5.3.0 - # - LJ_VER: 2.0.3 - # - LJ_VER: 2.1 + - LUA: "lua 5.1" + - LUA: "lua 5.2" + - LUA: "lua 5.3" platform: - x64 - x86 + # - mingw cache: - - c:\lua -> appveyor.yml - - c:\external -> appveyor.yml - - C:\Program Files (x86)\LuaRocks -> appveyor.yml - - C:\Program Files\LuaRocks -> appveyor.yml - -init: - - call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" %platform% + - c:\hererocks -> appveyor.yml install: - # Setup Lua development/build environment - - call .appveyor\install.bat + - set PATH=C:\Python27\Scripts;%PATH% + - if /I "%platform%"=="x86" set HR_TARGET=vs_32 + - if /I "%platform%"=="x64" set HR_TARGET=vs_64 + - if /I "%platform%"=="mingw" set HR_TARGET=mingw + - if /I "%platform%"=="mingw" set PATH=C:\MinGW\bin;%PATH% + - if not exist "%LR_EXTERNAL%" ( + mkdir "%LR_EXTERNAL%" && + mkdir "%LR_EXTERNAL%\lib" && + mkdir "%LR_EXTERNAL%\include" + ) + - if not exist c:\hererocks ( + pip install hererocks && + hererocks c:\hererocks --%LUA% --target %HR_TARGET% -rlatest && + call c:\hererocks\bin\activate + ) before_build: # external deps @@ -45,11 +51,11 @@ build_script: before_test: # test deps - - luarocks install lunitx - - luarocks install dkjson - - luarocks install luafilesystem - - if "%LUA_SHORTV%"=="5.1" luarocks install bit32 - - luarocks install lua-path + - if "%LUA%"=="lua 5.1" luarocks show bit32 >nul 2>&1 || luarocks install bit32 + - luarocks show lunitx >nul 2>&1 || luarocks install lunitx + - luarocks show dkjson >nul 2>&1 || luarocks install dkjson + - luarocks show luafilesystem >nul 2>&1 || luarocks install luafilesystem + - luarocks show lua-path >nul 2>&1 || luarocks install lua-path test_script: - echo "Testing..." From 60b8e3e0820ca7a631dc61c86f320ab8186bb134 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Wed, 16 Nov 2016 16:57:54 +0300 Subject: [PATCH 3/9] Fix. Build if `TCP_FASTOPEN` defined. --- src/lcopteasy.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lcopteasy.h b/src/lcopteasy.h index 1d8771c..b5531cf 100644 --- a/src/lcopteasy.h +++ b/src/lcopteasy.h @@ -30,6 +30,11 @@ # define LCURL_DEFAULT_VALUE 0 #endif +#ifdef TCP_FASTOPEN +# define LCURL__TCP_FASTOPEN TCP_FASTOPEN +# undef TCP_FASTOPEN +#endif + OPT_ENTRY( verbose, VERBOSE, LNG, 0, LCURL_DEFAULT_VALUE ) OPT_ENTRY( header, HEADER, LNG, 0, LCURL_DEFAULT_VALUE ) OPT_ENTRY( noprogress, NOPROGRESS, LNG, 0, 1 ) @@ -342,16 +347,19 @@ OPT_ENTRY( stream_weight, STREAM_WEIGHT, LNG, 0, LCUR #if LCURL_CURL_VER_GE(7,48,0) OPT_ENTRY( tftp_no_options, TFTP_NO_OPTIONS, LNG, 0, LCURL_DEFAULT_VALUE ) #endif - #if LCURL_CURL_VER_GE(7,49,0) OPT_ENTRY( tcp_fastopen, TCP_FASTOPEN, LNG, 0, LCURL_DEFAULT_VALUE ) OPT_ENTRY( connect_to, CONNECT_TO, LST, 0, LCURL_DEFAULT_VALUE ) #endif - #if LCURL_CURL_VER_GE(7,51,0) OPT_ENTRY( keep_sending_on_error, KEEP_SENDING_ON_ERROR, LNG, 0, LCURL_DEFAULT_VALUE ) #endif +#ifdef LCURL__TCP_FASTOPEN +# define TCP_FASTOPEN LCURL__TCP_FASTOPEN +# undef LCURL__TCP_FASTOPEN +#endif + #ifdef OPT_ENTRY_IS_NULL # undef OPT_ENTRY #endif From baab7c5ae76e482bb5692b4b640658e837be355f Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Wed, 16 Nov 2016 17:04:32 +0300 Subject: [PATCH 4/9] Fix. Use only one error name for same message. --- src/lcerr_easy.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lcerr_easy.h b/src/lcerr_easy.h index abde23e..a7f644e 100644 --- a/src/lcerr_easy.h +++ b/src/lcerr_easy.h @@ -11,6 +11,8 @@ ERR_ENTRY ( COULDNT_CONNECT ) ERR_ENTRY ( FTP_WEIRD_SERVER_REPLY ) #if LCURL_CURL_VER_GE(7,51,0) ERR_ENTRY ( WEIRD_SERVER_REPLY ) +#else +ERR_ENTRY ( FTP_WEIRD_SERVER_REPLY ) #endif ERR_ENTRY ( REMOTE_ACCESS_DENIED ) #if LCURL_CURL_VER_GE(7,31,0) From c8e821fb077790e560333f323692463432d78779 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Thu, 15 Dec 2016 14:08:30 +0300 Subject: [PATCH 5/9] Fix. Use `WEIRD_SERVER_REPLY` by default in libcurl > 7.51.0. --- src/lcerr_easy.h | 1 - src/lcerror.c | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lcerr_easy.h b/src/lcerr_easy.h index a7f644e..8450ed4 100644 --- a/src/lcerr_easy.h +++ b/src/lcerr_easy.h @@ -8,7 +8,6 @@ ERR_ENTRY ( NOT_BUILT_IN ) ERR_ENTRY ( COULDNT_RESOLVE_PROXY ) ERR_ENTRY ( COULDNT_RESOLVE_HOST ) ERR_ENTRY ( COULDNT_CONNECT ) -ERR_ENTRY ( FTP_WEIRD_SERVER_REPLY ) #if LCURL_CURL_VER_GE(7,51,0) ERR_ENTRY ( WEIRD_SERVER_REPLY ) #else diff --git a/src/lcerror.c b/src/lcerror.c index 29f7672..79a7a61 100644 --- a/src/lcerror.c +++ b/src/lcerror.c @@ -278,6 +278,15 @@ static const lcurl_const_t lcurl_error_codes[] = { #include "lcerr_easy.h" #undef ERR_ENTRY +/* libcurl rename CURLE_FTP_WEIRD_SERVER_REPLY to CURLE_WEIRD_SERVER_REPLY in version 7.51.0*/ +/* we can not have both codes in general because we have to be able convern error number to error name*/ +/* so we use newest name but add error code as alias.*/ +#if LCURL_CURL_VER_GE(7,51,0) + { "E_FTP_WEIRD_SERVER_REPLY", CURLE_FTP_WEIRD_SERVER_REPLY }, +#else + { "E_WEIRD_SERVER_REPLY", CURLE_WEIRD_SERVER_REPLY }, +#endif + #define ERR_ENTRY(N) { "E_MULTI_"#N, CURLM_##N }, #include "lcerr_multi.h" #undef ERR_ENTRY From 39accdb5b3af1207c86ba5c3714cc00504245a16 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Thu, 15 Dec 2016 14:28:37 +0300 Subject: [PATCH 6/9] Update test runner. --- appveyor.yml | 6 +++--- test/run.lua | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index c0fbb05..919b906 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,12 +11,12 @@ environment: matrix: - LUA: "lua 5.1" - - LUA: "lua 5.2" - - LUA: "lua 5.3" + # - LUA: "lua 5.2" + # - LUA: "lua 5.3" platform: - x64 - - x86 + # - x86 # - mingw cache: diff --git a/test/run.lua b/test/run.lua index 4bb5057..44a694b 100644 --- a/test/run.lua +++ b/test/run.lua @@ -12,7 +12,8 @@ local ok, curl = pcall(require, "cURL") local version if ok then version = curl.version() else - version = "" + io.stderr:write('can not load cURL:' .. curl) + os.exit(-1) end print("------------------------------------") From e47123e6d309358566062181a24050032aca4dc7 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Thu, 15 Dec 2016 14:32:58 +0300 Subject: [PATCH 7/9] Fix. appveyor set PATH to find external binaries. --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 919b906..abf60c8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -23,7 +23,7 @@ cache: - c:\hererocks -> appveyor.yml install: - - set PATH=C:\Python27\Scripts;%PATH% + - set PATH=C:\Python27\Scripts;%LR_EXTERNAL%;%PATH% - if /I "%platform%"=="x86" set HR_TARGET=vs_32 - if /I "%platform%"=="x64" set HR_TARGET=vs_64 - if /I "%platform%"=="mingw" set HR_TARGET=mingw From 714486c324af1fcca0140b553ed32637debf8705 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Thu, 15 Dec 2016 14:36:31 +0300 Subject: [PATCH 8/9] Update appveyor.yml --- appveyor.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index abf60c8..1327f6b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,12 +11,12 @@ environment: matrix: - LUA: "lua 5.1" - # - LUA: "lua 5.2" - # - LUA: "lua 5.3" + - LUA: "lua 5.2" + - LUA: "lua 5.3" platform: - x64 - # - x86 + - x86 # - mingw cache: From 0ffad3ce067f807eef348a855cacae093e51fc07 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Thu, 15 Dec 2016 14:56:17 +0300 Subject: [PATCH 9/9] Fix. Use `E_WEIRD_SERVER_REPLY` as alias for `CURLE_FTP_WEIRD_SERVER_REPLY` on libcurl<7.51.0. --- src/lcerror.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lcerror.c b/src/lcerror.c index 79a7a61..a130d9f 100644 --- a/src/lcerror.c +++ b/src/lcerror.c @@ -284,7 +284,7 @@ static const lcurl_const_t lcurl_error_codes[] = { #if LCURL_CURL_VER_GE(7,51,0) { "E_FTP_WEIRD_SERVER_REPLY", CURLE_FTP_WEIRD_SERVER_REPLY }, #else - { "E_WEIRD_SERVER_REPLY", CURLE_WEIRD_SERVER_REPLY }, + { "E_WEIRD_SERVER_REPLY", CURLE_FTP_WEIRD_SERVER_REPLY }, #endif #define ERR_ENTRY(N) { "E_MULTI_"#N, CURLM_##N },