@@ -32,7 +32,7 @@ impl Version {
32
32
/// Returns the libcurl version that this library is currently linked against.
33
33
pub fn get ( ) -> Version {
34
34
unsafe {
35
- let ptr = curl_sys:: curl_version_info ( curl_sys:: CURLVERSION_FOURTH ) ;
35
+ let ptr = curl_sys:: curl_version_info ( curl_sys:: CURLVERSION_NOW ) ;
36
36
assert ! ( !ptr. is_null( ) ) ;
37
37
Version { inner : ptr }
38
38
}
@@ -245,6 +245,39 @@ impl Version {
245
245
}
246
246
}
247
247
}
248
+
249
+ /// If available, the version of nghttp2 libcurl is linked against.
250
+ pub fn nghttp2_version_num ( & self ) -> Option < u32 > {
251
+ unsafe {
252
+ if ( * self . inner ) . age >= curl_sys:: CURLVERSION_SIXTH {
253
+ Some ( ( * self . inner ) . nghttp2_ver_num )
254
+ } else {
255
+ None
256
+ }
257
+ }
258
+ }
259
+
260
+ /// If available, the version of nghttp2 libcurl is linked against.
261
+ pub fn nghttp2_version ( & self ) -> Option < & str > {
262
+ unsafe {
263
+ if ( * self . inner ) . age >= curl_sys:: CURLVERSION_SIXTH {
264
+ :: opt_str ( ( * self . inner ) . nghttp2_version )
265
+ } else {
266
+ None
267
+ }
268
+ }
269
+ }
270
+
271
+ /// If available, the version of quic libcurl is linked against.
272
+ pub fn quic_version ( & self ) -> Option < & str > {
273
+ unsafe {
274
+ if ( * self . inner ) . age >= curl_sys:: CURLVERSION_SIXTH {
275
+ :: opt_str ( ( * self . inner ) . quic_version )
276
+ } else {
277
+ None
278
+ }
279
+ }
280
+ }
248
281
}
249
282
250
283
impl fmt:: Debug for Version {
@@ -286,6 +319,21 @@ impl fmt::Debug for Version {
286
319
if let Some ( s) = self . libssh_version ( ) {
287
320
f. field ( "libssh_version" , & s) ;
288
321
}
322
+ if let Some ( s) = self . brotli_version_num ( ) {
323
+ f. field ( "brotli_version_num" , & format ! ( "{:x}" , s) ) ;
324
+ }
325
+ if let Some ( s) = self . brotli_version ( ) {
326
+ f. field ( "brotli_version" , & s) ;
327
+ }
328
+ if let Some ( s) = self . nghttp2_version_num ( ) {
329
+ f. field ( "nghttp2_version_num" , & format ! ( "{:x}" , s) ) ;
330
+ }
331
+ if let Some ( s) = self . nghttp2_version ( ) {
332
+ f. field ( "nghttp2_version" , & s) ;
333
+ }
334
+ if let Some ( s) = self . quic_version ( ) {
335
+ f. field ( "quic_version" , & s) ;
336
+ }
289
337
290
338
f. field ( "protocols" , & self . protocols ( ) . collect :: < Vec < _ > > ( ) ) ;
291
339
0 commit comments