@@ -323,6 +323,25 @@ static int lcurl_opt_set_long_(lua_State *L, int opt){
323323 return 1 ;
324324}
325325
326+ #if LCURL_CURL_VER_GE (7 ,59 ,0 )
327+
328+ static int lcurl_opt_set_off_ (lua_State * L , int opt ){
329+ lcurl_easy_t * p = lcurl_geteasy (L );
330+ curl_off_t val ; CURLcode code ;
331+
332+ luaL_argcheck (L , lua_type (L , 2 ) == LUA_TNUMBER , 2 , "number expected" );
333+ val = lutil_checkint64 (L , 2 );
334+
335+ code = curl_easy_setopt (p -> curl , opt , val );
336+ if (code != CURLE_OK ){
337+ return lcurl_fail_ex (L , p -> err_mode , LCURL_ERROR_EASY , code );
338+ }
339+ lua_settop (L , 1 );
340+ return 1 ;
341+ }
342+
343+ #endif
344+
326345static int lcurl_opt_set_string_ (lua_State * L , int opt , int store ){
327346 lcurl_easy_t * p = lcurl_geteasy (L );
328347 CURLcode code ;
@@ -378,6 +397,10 @@ static int lcurl_opt_set_slist_(lua_State *L, int opt, int list_no){
378397 return lcurl_opt_set_long_(L, CURLOPT_##N);\
379398}
380399
400+ #define LCURL_OFF_OPT (N , S ) static int lcurl_easy_set_##N(lua_State *L){\
401+ return lcurl_opt_set_off_(L, CURLOPT_##N);\
402+ }
403+
381404#define OPT_ENTRY (L , N , T , S , D ) LCURL_##T##_OPT(N, S)
382405
383406#include "lcopteasy.h"
@@ -409,6 +432,7 @@ static int lcurl_easy_set_POSTFIELDS(lua_State *L){
409432#undef LCURL_STR_OPT
410433#undef LCURL_LST_OPT
411434#undef LCURL_LNG_OPT
435+ #undef LCURL_OFF_OPT
412436
413437static size_t lcurl_hpost_read_callback (char * buffer , size_t size , size_t nitems , void * arg );
414438
@@ -508,6 +532,22 @@ static int lcurl_opt_unset_long_(lua_State *L, int opt, long val){
508532 return 1 ;
509533}
510534
535+ #if LCURL_CURL_VER_GE (7 ,59 ,0 )
536+
537+ static int lcurl_opt_unset_off_ (lua_State * L , int opt , curl_off_t val ){
538+ lcurl_easy_t * p = lcurl_geteasy (L );
539+ CURLcode code ;
540+
541+ code = curl_easy_setopt (p -> curl , opt , val );
542+ if (code != CURLE_OK ){
543+ return lcurl_fail_ex (L , p -> err_mode , LCURL_ERROR_EASY , code );
544+ }
545+ lua_settop (L , 1 );
546+ return 1 ;
547+ }
548+
549+ #endif
550+
511551static int lcurl_opt_unset_string_ (lua_State * L , int opt , const char * val ){
512552 lcurl_easy_t * p = lcurl_geteasy (L );
513553 CURLcode code ;
@@ -556,6 +596,10 @@ static int lcurl_opt_unset_slist_(lua_State *L, int opt, int list_no){
556596 return lcurl_opt_unset_long_(L, CURLOPT_##N, (D));\
557597}
558598
599+ #define LCURL_OFF_OPT (N , S , D ) static int lcurl_easy_unset_##N(lua_State *L){\
600+ return lcurl_opt_unset_off_(L, CURLOPT_##N, (D));\
601+ }
602+
559603#define OPT_ENTRY (L , N , T , S , D ) LCURL_##T##_OPT(N, S, D)
560604
561605#include "lcopteasy.h"
@@ -565,6 +609,7 @@ static int lcurl_opt_unset_slist_(lua_State *L, int opt, int list_no){
565609#undef LCURL_STR_OPT
566610#undef LCURL_LST_OPT
567611#undef LCURL_LNG_OPT
612+ #undef LCURL_OFF_OPT
568613
569614static int lcurl_easy_unset_HTTPPOST (lua_State * L ){
570615 lcurl_easy_t * p = lcurl_geteasy (L );
0 commit comments