@@ -116,7 +116,6 @@ local function make_iterator(self, perform)
116116 end
117117end
118118
119-
120119-- name = <string>/<stream>/<file>/<buffer>/<content>
121120--
122121-- <stream> = {
@@ -504,23 +503,60 @@ function Easy:setopt_httppost(form)
504503 return setopt_httppost (self , form :handle ())
505504end
506505
506+ if curl .OPT_STREAM_DEPENDS then
507+
508+ local setopt_stream_depends = wrap_function (" setopt_stream_depends" )
509+ function Easy :setopt_stream_depends (easy )
510+ return setopt_stream_depends (self , easy :handle ())
511+ end
512+
513+ local setopt_stream_depends_e = wrap_function (" setopt_stream_depends_e" )
514+ function Easy :setopt_stream_depends_e (easy )
515+ return setopt_stream_depends_e (self , easy :handle ())
516+ end
517+
518+ end
519+
507520local setopt = wrap_function (" setopt" )
521+ local custom_setopt = {
522+ [curl .OPT_HTTPPOST or true ] = ' setopt_httppost' ;
523+ [curl .OPT_STREAM_DEPENDS or true ] = ' setopt_stream_depends' ;
524+ [curl .OPT_STREAM_DEPENDS_E or true ] = ' setopt_stream_depends_e' ;
525+ }
526+ custom_setopt [true ] = nil
527+
508528function Easy :setopt (k , v )
509529 if type (k ) == ' table' then
510530 local t = k
511531
532+ local t2
512533 local hpost = t .httppost or t [curl .OPT_HTTPPOST ]
513534 if hpost and hpost ._handle then
514- t = clone (t )
535+ t = t2 or clone (t ); t2 = t ;
515536 if t .httppost then t .httppost = hpost :handle () end
516537 if t [curl .OPT_HTTPPOST ] then t [curl .OPT_HTTPPOST ] = hpost :handle () end
517538 end
518539
540+ local easy = t .stream_depends or t [curl .OPT_STREAM_DEPENDS ]
541+ if easy and easy ._handle then
542+ t = t2 or clone (t ); t2 = t ;
543+ if t .stream_depends then t .stream_depends = easy :handle () end
544+ if t [curl .OPT_STREAM_DEPENDS ] then t [curl .OPT_STREAM_DEPENDS ] = easy :handle () end
545+ end
546+
547+ local easy = t .stream_depends_e or t [curl .OPT_STREAM_DEPENDS_E ]
548+ if easy and easy ._handle then
549+ t = t2 or clone (t ); t2 = t ;
550+ if t .stream_depends_e then t .stream_depends_e = easy :handle () end
551+ if t [curl .OPT_STREAM_DEPENDS_E ] then t [curl .OPT_STREAM_DEPENDS_E ] = easy :handle () end
552+ end
553+
519554 return setopt (self , t )
520555 end
521556
522- if k == curl .OPT_HTTPPOST then
523- return self :setopt_httppost (v )
557+ local setname = custom_setopt [k ]
558+ if setname then
559+ return self [setname ](self , v )
524560 end
525561
526562 return setopt (self , k , v )
0 commit comments