Skip to content

Commit 8916f54

Browse files
committed
Fix. Handle new return code for curl_formget in libcurl 7.56.0
1 parent 0e1eaa5 commit 8916f54

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/lchttppost.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ static const char *LCURL_HTTPPOST = LCURL_HTTPPOST_NAME;
4444
# define LCURL_LEN_TYPE long
4545
#endif
4646

47+
/* 7.56.0 changed code for `curl_formget` if callback abort write
48+
* not sure is it bug or not so set only for single version
49+
**/
50+
#if LCURL_CURL_VER_GE(7,56,0) && !LCURL_CURL_VER_GE(7,56,1)
51+
# define LCURL_GET_CB_ERROR CURLE_READ_ERROR
52+
#else
53+
# define LCURL_GET_CB_ERROR (CURLcode)-1
54+
#endif
55+
4756
//{ stream
4857

4958
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){
525534
return lua_error(L);
526535
}
527536

528-
if((CURLcode)-1 == code){
537+
if(LCURL_GET_CB_ERROR == code){
529538
if(((lua_gettop(L) == top+1))&&(lua_isstring(L, -1))){
530539
return lua_error(L);
531540
}

0 commit comments

Comments
 (0)