From 8916f541d9f2d2cdce6db368d4579392dfbe0125 Mon Sep 17 00:00:00 2001 From: Alexey Melnichuk Date: Thu, 12 Oct 2017 15:39:57 +0300 Subject: [PATCH] Fix. Handle new return code for curl_formget in libcurl 7.56.0 --- src/lchttppost.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lchttppost.c b/src/lchttppost.c index 0200339..e3b315a 100644 --- a/src/lchttppost.c +++ b/src/lchttppost.c @@ -44,6 +44,15 @@ static const char *LCURL_HTTPPOST = LCURL_HTTPPOST_NAME; # define LCURL_LEN_TYPE long #endif +/* 7.56.0 changed code for `curl_formget` if callback abort write + * not sure is it bug or not so set only for single version + **/ +#if LCURL_CURL_VER_GE(7,56,0) && !LCURL_CURL_VER_GE(7,56,1) +# define LCURL_GET_CB_ERROR CURLE_READ_ERROR +#else +# define LCURL_GET_CB_ERROR (CURLcode)-1 +#endif + //{ stream static lcurl_hpost_stream_t *lcurl_hpost_stream_add(lua_State *L, lcurl_hpost_t *p){ @@ -525,7 +534,7 @@ static int lcurl_hpost_get(lua_State *L){ return lua_error(L); } - if((CURLcode)-1 == code){ + if(LCURL_GET_CB_ERROR == code){ if(((lua_gettop(L) == top+1))&&(lua_isstring(L, -1))){ return lua_error(L); }