Fix. Handle new return code for curl_formget in libcurl 7.56.0

This commit is contained in:
Alexey Melnichuk 2017-10-12 15:39:57 +03:00
parent 0e1eaa525a
commit 8916f541d9

View File

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