File tree Expand file tree Collapse file tree 4 files changed +19
-0
lines changed Expand file tree Collapse file tree 4 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -582,6 +582,8 @@ pub const CURLOPT_PROXY_CAPATH: CURLoption = CURLOPTTYPE_OBJECTPOINT + 247;
582582pub const CURLOPT_PROXY_SSLCERT : CURLoption = CURLOPTTYPE_OBJECTPOINT + 254 ;
583583pub const CURLOPT_PROXY_SSLKEY : CURLoption = CURLOPTTYPE_OBJECTPOINT + 256 ;
584584
585+ pub const CURLOPT_MAXAGE_CONN : CURLoption = CURLOPTTYPE_LONG + 288 ;
586+
585587pub const CURL_IPRESOLVE_WHATEVER : c_int = 0 ;
586588pub const CURL_IPRESOLVE_V4 : c_int = 1 ;
587589pub const CURL_IPRESOLVE_V6 : c_int = 2 ;
Original file line number Diff line number Diff line change @@ -905,6 +905,11 @@ impl Easy {
905905 self . inner . max_connects ( max)
906906 }
907907
908+ /// Same as [`Easy2::maxage_conn`](struct.Easy2.html#method.maxage_conn)
909+ pub fn maxage_conn ( & mut self , max_age : Duration ) -> Result < ( ) , Error > {
910+ self . inner . maxage_conn ( max_age)
911+ }
912+
908913 /// Same as [`Easy2::fresh_connect`](struct.Easy2.html#method.fresh_connect)
909914 pub fn fresh_connect ( & mut self , enable : bool ) -> Result < ( ) , Error > {
910915 self . inner . fresh_connect ( enable)
Original file line number Diff line number Diff line change @@ -1741,6 +1741,17 @@ impl<H> Easy2<H> {
17411741 self . setopt_long ( curl_sys:: CURLOPT_MAXCONNECTS , max as c_long )
17421742 }
17431743
1744+ /// Set the maximum idle time allowed for a connection.
1745+ ///
1746+ /// This configuration sets the maximum time that a connection inside of the connection cache
1747+ /// can be reused. Any connection older than this value will be considered stale and will
1748+ /// be closed.
1749+ ///
1750+ /// By default, a value of 118 seconds is used.
1751+ pub fn maxage_conn ( & mut self , max_age : Duration ) -> Result < ( ) , Error > {
1752+ self . setopt_long ( curl_sys:: CURLOPT_MAXAGE_CONN , max_age. as_secs ( ) as c_long )
1753+ }
1754+
17441755 /// Force a new connection to be used.
17451756 ///
17461757 /// Makes the next transfer use a new (fresh) connection by force instead of
Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ fn main() {
7979 if version < 66 {
8080 match s {
8181 "CURL_HTTP_VERSION_3" => return true ,
82+ "CURLOPT_MAXAGE_CONN" => return true ,
8283 _ => { }
8384 }
8485 }
You can’t perform that action at this time.
0 commit comments