1
+ use std:: path:: PathBuf ;
1
2
use std:: {
2
3
any:: Any ,
3
4
borrow:: Cow ,
@@ -10,6 +11,7 @@ use git_packetline::PacketLineRef;
10
11
pub use traits:: { Error , GetResponse , Http , PostResponse } ;
11
12
12
13
use crate :: client:: blocking_io:: bufread_ext:: ReadlineBufRead ;
14
+ use crate :: client:: http:: options:: { HttpVersion , SslVersionRangeInclusive } ;
13
15
use crate :: {
14
16
client:: { self , capabilities, Capabilities , ExtendedBufRead , HandleProgress , MessageKind , RequestWriter } ,
15
17
Protocol , Service ,
@@ -19,7 +21,8 @@ use crate::{
19
21
compile_error ! ( "Cannot set both 'http-client-reqwest' and 'http-client-curl' features as they are mutually exclusive" ) ;
20
22
21
23
#[ cfg( feature = "http-client-curl" ) ]
22
- mod curl;
24
+ ///
25
+ pub mod curl;
23
26
24
27
/// The experimental `reqwest` backend.
25
28
///
@@ -73,6 +76,51 @@ pub mod options {
73
76
ProxyAuthMethod :: AnyAuth
74
77
}
75
78
}
79
+
80
+ /// Available SSL version numbers.
81
+ #[ derive( Debug , Copy , Clone , PartialEq , Eq , Ord , PartialOrd ) ]
82
+ #[ allow( missing_docs) ]
83
+ pub enum SslVersion {
84
+ /// The implementation default, which is unknown to this layer of abstraction.
85
+ Default ,
86
+ TlsV1 ,
87
+ SslV2 ,
88
+ SslV3 ,
89
+ TlsV1_0 ,
90
+ TlsV1_1 ,
91
+ TlsV1_2 ,
92
+ TlsV1_3 ,
93
+ }
94
+
95
+ /// Available HTTP version numbers.
96
+ #[ derive( Debug , Copy , Clone , PartialEq , Eq , Ord , PartialOrd ) ]
97
+ #[ allow( missing_docs) ]
98
+ pub enum HttpVersion {
99
+ /// Equivalent to HTTP/1.1
100
+ V1_1 ,
101
+ /// Equivalent to HTTP/2
102
+ V2 ,
103
+ }
104
+
105
+ /// The desired range of acceptable SSL versions, or the single version to allow if both are set to the same value.
106
+ #[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
107
+ pub struct SslVersionRangeInclusive {
108
+ /// The smallest allowed ssl version to use.
109
+ pub min : SslVersion ,
110
+ /// The highest allowed ssl version to use.
111
+ pub max : SslVersion ,
112
+ }
113
+
114
+ impl SslVersionRangeInclusive {
115
+ /// Return `min` and `max` fields in the right order so `min` is smaller or equal to `max`.
116
+ pub fn min_max ( & self ) -> ( SslVersion , SslVersion ) {
117
+ if self . min > self . max {
118
+ ( self . max , self . min )
119
+ } else {
120
+ ( self . min , self . max )
121
+ }
122
+ }
123
+ }
76
124
}
77
125
78
126
/// Options to configure http requests.
@@ -131,6 +179,12 @@ pub struct Options {
131
179
pub connect_timeout : Option < std:: time:: Duration > ,
132
180
/// If enabled, emit additional information about connections and possibly the data received or written.
133
181
pub verbose : bool ,
182
+ /// If set, use this path to point to a file with CA certificates to verify peers.
183
+ pub ssl_ca_info : Option < PathBuf > ,
184
+ /// The SSL version or version range to use, or `None` to let the TLS backend determine which versions are acceptable.
185
+ pub ssl_version : Option < SslVersionRangeInclusive > ,
186
+ /// The HTTP version to enforce. If unset, it is implementation defined.
187
+ pub http_version : Option < HttpVersion > ,
134
188
/// Backend specific options, if available.
135
189
pub backend : Option < Arc < Mutex < dyn Any + Send + Sync + ' static > > > ,
136
190
}
0 commit comments