Skip to content

Commit fc476eb

Browse files
authored
Merge pull request #86 from moteus/master
Add. Support cURL 7.51.0
2 parents c05112c + 0ffad3c commit fc476eb

File tree

5 files changed

+55
-24
lines changed

5 files changed

+55
-24
lines changed

appveyor.yml

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,38 @@ os:
66
shallow_clone: true
77

88
environment:
9-
LUAROCKS_VER: 2.2.1
10-
CURL_VER: 7.50.1
9+
LR_EXTERNAL: c:\external
10+
CURL_VER: 7.51.0
1111

1212
matrix:
13-
- LUA_VER: 5.1.5
14-
- LUA_VER: 5.2.4
15-
- LUA_VER: 5.3.0
16-
# - LJ_VER: 2.0.3
17-
# - LJ_VER: 2.1
13+
- LUA: "lua 5.1"
14+
- LUA: "lua 5.2"
15+
- LUA: "lua 5.3"
1816

1917
platform:
2018
- x64
2119
- x86
20+
# - mingw
2221

2322
cache:
24-
- c:\lua -> appveyor.yml
25-
- c:\external -> appveyor.yml
26-
- C:\Program Files (x86)\LuaRocks -> appveyor.yml
27-
- C:\Program Files\LuaRocks -> appveyor.yml
28-
29-
init:
30-
- call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" %platform%
23+
- c:\hererocks -> appveyor.yml
3124

3225
install:
33-
# Setup Lua development/build environment
34-
- call .appveyor\install.bat
26+
- set PATH=C:\Python27\Scripts;%LR_EXTERNAL%;%PATH%
27+
- if /I "%platform%"=="x86" set HR_TARGET=vs_32
28+
- if /I "%platform%"=="x64" set HR_TARGET=vs_64
29+
- if /I "%platform%"=="mingw" set HR_TARGET=mingw
30+
- if /I "%platform%"=="mingw" set PATH=C:\MinGW\bin;%PATH%
31+
- if not exist "%LR_EXTERNAL%" (
32+
mkdir "%LR_EXTERNAL%" &&
33+
mkdir "%LR_EXTERNAL%\lib" &&
34+
mkdir "%LR_EXTERNAL%\include"
35+
)
36+
- if not exist c:\hererocks (
37+
pip install hererocks &&
38+
hererocks c:\hererocks --%LUA% --target %HR_TARGET% -rlatest &&
39+
call c:\hererocks\bin\activate
40+
)
3541

3642
before_build:
3743
# external deps
@@ -45,11 +51,11 @@ build_script:
4551

4652
before_test:
4753
# test deps
48-
- luarocks install lunitx
49-
- luarocks install dkjson
50-
- luarocks install luafilesystem
51-
- if "%LUA_SHORTV%"=="5.1" luarocks install bit32
52-
- luarocks install lua-path
54+
- if "%LUA%"=="lua 5.1" luarocks show bit32 >nul 2>&1 || luarocks install bit32
55+
- luarocks show lunitx >nul 2>&1 || luarocks install lunitx
56+
- luarocks show dkjson >nul 2>&1 || luarocks install dkjson
57+
- luarocks show luafilesystem >nul 2>&1 || luarocks install luafilesystem
58+
- luarocks show lua-path >nul 2>&1 || luarocks install lua-path
5359

5460
test_script:
5561
- echo "Testing..."

src/lcerr_easy.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ ERR_ENTRY ( NOT_BUILT_IN )
88
ERR_ENTRY ( COULDNT_RESOLVE_PROXY )
99
ERR_ENTRY ( COULDNT_RESOLVE_HOST )
1010
ERR_ENTRY ( COULDNT_CONNECT )
11+
#if LCURL_CURL_VER_GE(7,51,0)
12+
ERR_ENTRY ( WEIRD_SERVER_REPLY )
13+
#else
1114
ERR_ENTRY ( FTP_WEIRD_SERVER_REPLY )
15+
#endif
1216
ERR_ENTRY ( REMOTE_ACCESS_DENIED )
1317
#if LCURL_CURL_VER_GE(7,31,0)
1418
ERR_ENTRY ( FTP_ACCEPT_FAILED )

src/lcerror.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,15 @@ static const lcurl_const_t lcurl_error_codes[] = {
278278
#include "lcerr_easy.h"
279279
#undef ERR_ENTRY
280280

281+
/* libcurl rename CURLE_FTP_WEIRD_SERVER_REPLY to CURLE_WEIRD_SERVER_REPLY in version 7.51.0*/
282+
/* we can not have both codes in general because we have to be able convern error number to error name*/
283+
/* so we use newest name but add error code as alias.*/
284+
#if LCURL_CURL_VER_GE(7,51,0)
285+
{ "E_FTP_WEIRD_SERVER_REPLY", CURLE_FTP_WEIRD_SERVER_REPLY },
286+
#else
287+
{ "E_WEIRD_SERVER_REPLY", CURLE_FTP_WEIRD_SERVER_REPLY },
288+
#endif
289+
281290
#define ERR_ENTRY(N) { "E_MULTI_"#N, CURLM_##N },
282291
#include "lcerr_multi.h"
283292
#undef ERR_ENTRY

src/lcopteasy.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@
3030
# define LCURL_DEFAULT_VALUE 0
3131
#endif
3232

33+
#ifdef TCP_FASTOPEN
34+
# define LCURL__TCP_FASTOPEN TCP_FASTOPEN
35+
# undef TCP_FASTOPEN
36+
#endif
37+
3338
OPT_ENTRY( verbose, VERBOSE, LNG, 0, LCURL_DEFAULT_VALUE )
3439
OPT_ENTRY( header, HEADER, LNG, 0, LCURL_DEFAULT_VALUE )
3540
OPT_ENTRY( noprogress, NOPROGRESS, LNG, 0, 1 )
@@ -342,11 +347,18 @@ OPT_ENTRY( stream_weight, STREAM_WEIGHT, LNG, 0, LCUR
342347
#if LCURL_CURL_VER_GE(7,48,0)
343348
OPT_ENTRY( tftp_no_options, TFTP_NO_OPTIONS, LNG, 0, LCURL_DEFAULT_VALUE )
344349
#endif
345-
346350
#if LCURL_CURL_VER_GE(7,49,0)
347351
OPT_ENTRY( tcp_fastopen, TCP_FASTOPEN, LNG, 0, LCURL_DEFAULT_VALUE )
348352
OPT_ENTRY( connect_to, CONNECT_TO, LST, 0, LCURL_DEFAULT_VALUE )
349353
#endif
354+
#if LCURL_CURL_VER_GE(7,51,0)
355+
OPT_ENTRY( keep_sending_on_error, KEEP_SENDING_ON_ERROR, LNG, 0, LCURL_DEFAULT_VALUE )
356+
#endif
357+
358+
#ifdef LCURL__TCP_FASTOPEN
359+
# define TCP_FASTOPEN LCURL__TCP_FASTOPEN
360+
# undef LCURL__TCP_FASTOPEN
361+
#endif
350362

351363
#ifdef OPT_ENTRY_IS_NULL
352364
# undef OPT_ENTRY
@@ -355,4 +367,3 @@ OPT_ENTRY( connect_to, CONNECT_TO, LST, 0, LCUR
355367
#ifdef FLG_ENTRY_IS_NULL
356368
# undef FLG_ENTRY
357369
#endif
358-

test/run.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ local ok, curl = pcall(require, "cURL")
1212
local version if ok then
1313
version = curl.version()
1414
else
15-
version = "<UNKNOWN>"
15+
io.stderr:write('can not load cURL:' .. curl)
16+
os.exit(-1)
1617
end
1718

1819
print("------------------------------------")

0 commit comments

Comments
 (0)