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); }