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;
582
582
pub const CURLOPT_PROXY_SSLCERT : CURLoption = CURLOPTTYPE_OBJECTPOINT + 254 ;
583
583
pub const CURLOPT_PROXY_SSLKEY : CURLoption = CURLOPTTYPE_OBJECTPOINT + 256 ;
584
584
585
+ pub const CURLOPT_MAXAGE_CONN : CURLoption = CURLOPTTYPE_LONG + 288 ;
586
+
585
587
pub const CURL_IPRESOLVE_WHATEVER : c_int = 0 ;
586
588
pub const CURL_IPRESOLVE_V4 : c_int = 1 ;
587
589
pub const CURL_IPRESOLVE_V6 : c_int = 2 ;
Original file line number Diff line number Diff line change @@ -905,6 +905,11 @@ impl Easy {
905
905
self . inner . max_connects ( max)
906
906
}
907
907
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
+
908
913
/// Same as [`Easy2::fresh_connect`](struct.Easy2.html#method.fresh_connect)
909
914
pub fn fresh_connect ( & mut self , enable : bool ) -> Result < ( ) , Error > {
910
915
self . inner . fresh_connect ( enable)
Original file line number Diff line number Diff line change @@ -1741,6 +1741,17 @@ impl<H> Easy2<H> {
1741
1741
self . setopt_long ( curl_sys:: CURLOPT_MAXCONNECTS , max as c_long )
1742
1742
}
1743
1743
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
+
1744
1755
/// Force a new connection to be used.
1745
1756
///
1746
1757
/// 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() {
79
79
if version < 66 {
80
80
match s {
81
81
"CURL_HTTP_VERSION_3" => return true ,
82
+ "CURLOPT_MAXAGE_CONN" => return true ,
82
83
_ => { }
83
84
}
84
85
}
You can’t perform that action at this time.
0 commit comments