@@ -10,7 +10,7 @@ use libc::{c_char, c_int, c_long, c_short, c_void};
10
10
#[ cfg( unix) ]
11
11
use libc:: { pollfd, POLLIN , POLLOUT , POLLPRI } ;
12
12
13
- use easy:: { Easy , Easy2 } ;
13
+ use easy:: { Easy , Easy2 , List } ;
14
14
use panic;
15
15
use { Error , MultiError } ;
16
16
@@ -695,6 +695,60 @@ impl Drop for Multi {
695
695
}
696
696
}
697
697
698
+ macro_rules! impl_easy_getters {
699
+ ( ) => {
700
+ impl_easy_getters! {
701
+ time_condition_unmet -> bool ,
702
+ effective_url -> Option <& str >,
703
+ effective_url_bytes -> Option <& [ u8 ] >,
704
+ response_code -> u32 ,
705
+ http_connectcode -> u32 ,
706
+ filetime -> Option <i64 >,
707
+ download_size -> f64 ,
708
+ content_length_download -> f64 ,
709
+ total_time -> Duration ,
710
+ namelookup_time -> Duration ,
711
+ connect_time -> Duration ,
712
+ appconnect_time -> Duration ,
713
+ pretransfer_time -> Duration ,
714
+ starttransfer_time -> Duration ,
715
+ redirect_time -> Duration ,
716
+ redirect_count -> u32 ,
717
+ redirect_url -> Option <& str >,
718
+ redirect_url_bytes -> Option <& [ u8 ] >,
719
+ header_size -> u64 ,
720
+ request_size -> u64 ,
721
+ content_type -> Option <& str >,
722
+ content_type_bytes -> Option <& [ u8 ] >,
723
+ os_errno -> i32 ,
724
+ primary_ip -> Option <& str >,
725
+ primary_port -> u16 ,
726
+ local_ip -> Option <& str >,
727
+ local_port -> u16 ,
728
+ cookies -> List ,
729
+ }
730
+ } ;
731
+
732
+ ( $( $name: ident -> $ret: ty, ) * ) => {
733
+ $(
734
+ impl_easy_getters!( $name, $ret, concat!(
735
+ "Same as [`Easy2::" ,
736
+ stringify!( $name) ,
737
+ "`](../easy/struct.Easy2.html#method." ,
738
+ stringify!( $name) ,
739
+ ")."
740
+ ) ) ;
741
+ ) *
742
+ } ;
743
+
744
+ ( $name: ident, $ret: ty, $doc: expr) => {
745
+ #[ doc = $doc]
746
+ pub fn $name( & mut self ) -> Result <$ret, Error > {
747
+ self . easy. $name( )
748
+ }
749
+ } ;
750
+ }
751
+
698
752
impl EasyHandle {
699
753
/// Sets an internal private token for this `EasyHandle`.
700
754
///
@@ -710,6 +764,8 @@ impl EasyHandle {
710
764
}
711
765
}
712
766
767
+ impl_easy_getters ! ( ) ;
768
+
713
769
/// Unpause reading on a connection.
714
770
///
715
771
/// Using this function, you can explicitly unpause a connection that was
@@ -737,6 +793,11 @@ impl EasyHandle {
737
793
pub fn unpause_write ( & self ) -> Result < ( ) , Error > {
738
794
self . easy . unpause_write ( )
739
795
}
796
+
797
+ /// Get a pointer to the raw underlying CURL handle.
798
+ pub fn raw ( & self ) -> * mut curl_sys:: CURL {
799
+ self . easy . raw ( )
800
+ }
740
801
}
741
802
742
803
impl fmt:: Debug for EasyHandle {
@@ -767,6 +828,8 @@ impl<H> Easy2Handle<H> {
767
828
}
768
829
}
769
830
831
+ impl_easy_getters ! ( ) ;
832
+
770
833
/// Unpause reading on a connection.
771
834
///
772
835
/// Using this function, you can explicitly unpause a connection that was
@@ -794,6 +857,11 @@ impl<H> Easy2Handle<H> {
794
857
pub fn unpause_write ( & self ) -> Result < ( ) , Error > {
795
858
self . easy . unpause_write ( )
796
859
}
860
+
861
+ /// Get a pointer to the raw underlying CURL handle.
862
+ pub fn raw ( & self ) -> * mut curl_sys:: CURL {
863
+ self . easy . raw ( )
864
+ }
797
865
}
798
866
799
867
impl < H : fmt:: Debug > fmt:: Debug for Easy2Handle < H > {
0 commit comments