File tree Expand file tree Collapse file tree 4 files changed +39
-6
lines changed Expand file tree Collapse file tree 4 files changed +39
-6
lines changed Original file line number Diff line number Diff line change @@ -587,6 +587,7 @@ pub const CURLOPT_SSL_OPTIONS: CURLoption = CURLOPTTYPE_LONG + 216;
587587// pub const CURLOPT_LOGIN_OPTIONS: CURLoption = CURLOPTTYPE_OBJECTPOINT + 224;
588588pub const CURLOPT_EXPECT_100_TIMEOUT_MS : CURLoption = CURLOPTTYPE_LONG + 227 ;
589589pub const CURLOPT_UNIX_SOCKET_PATH : CURLoption = CURLOPTTYPE_OBJECTPOINT + 231 ;
590+ pub const CURLOPT_PATH_AS_IS : CURLoption = CURLOPTTYPE_LONG + 234 ;
590591pub const CURLOPT_PIPEWAIT : CURLoption = CURLOPTTYPE_LONG + 237 ;
591592pub const CURLOPT_CONNECT_TO : CURLoption = CURLOPTTYPE_OBJECTPOINT + 243 ;
592593pub const CURLOPT_PROXY_CAINFO : CURLoption = CURLOPTTYPE_OBJECTPOINT + 246 ;
Original file line number Diff line number Diff line change @@ -563,6 +563,11 @@ impl Easy {
563563 self . inner . connect_to ( list)
564564 }
565565
566+ /// Same as [`Easy2::path_as_is`](struct.Easy2.html#method.path_as_is)
567+ pub fn path_as_is ( & mut self , as_is : bool ) -> Result < ( ) , Error > {
568+ self . inner . path_as_is ( as_is)
569+ }
570+
566571 /// Same as [`Easy2::proxy`](struct.Easy2.html#method.proxy)
567572 pub fn proxy ( & mut self , url : & str ) -> Result < ( ) , Error > {
568573 self . inner . proxy ( url)
Original file line number Diff line number Diff line change @@ -880,12 +880,13 @@ impl<H> Easy2<H> {
880880 self . setopt_ptr ( curl_sys:: CURLOPT_CONNECT_TO , ptr as * const _ )
881881 }
882882
883- // /// Indicates whether sequences of `/../` and `/./` will be squashed or not.
884- // ///
885- // /// By default this option is `false` and corresponds to
886- // /// `CURLOPT_PATH_AS_IS`.
887- // pub fn path_as_is(&mut self, as_is: bool) -> Result<(), Error> {
888- // }
883+ /// Indicates whether sequences of `/../` and `/./` will be squashed or not.
884+ ///
885+ /// By default this option is `false` and corresponds to
886+ /// `CURLOPT_PATH_AS_IS`.
887+ pub fn path_as_is ( & mut self , as_is : bool ) -> Result < ( ) , Error > {
888+ self . setopt_long ( curl_sys:: CURLOPT_PATH_AS_IS , as_is as c_long )
889+ }
889890
890891 /// Provide the URL of a proxy to use.
891892 ///
Original file line number Diff line number Diff line change @@ -849,3 +849,29 @@ fn test_upkeep() {
849849 // Ensure that upkeep can be called on the handle without problem.
850850 t ! ( handle. upkeep( ) ) ;
851851}
852+
853+ #[ test]
854+ fn path_as_is ( ) {
855+ let s = Server :: new ( ) ;
856+ s. receive (
857+ "\
858+ GET /test/../ HTTP/1.1\r \n \
859+ Host: 127.0.0.1:$PORT\r \n \
860+ Accept: */*\r \n \
861+ \r \n ",
862+ ) ;
863+ s. send (
864+ "\
865+ HTTP/1.1 200 OK\r \n \
866+ \r \n ",
867+ ) ;
868+
869+ let mut h = handle ( ) ;
870+ t ! ( h. url( & s. url( "/test/../" ) ) ) ;
871+ t ! ( h. path_as_is( true ) ) ;
872+ t ! ( h. perform( ) ) ;
873+
874+ let addr = format ! ( "http://{}/test/../" , s. addr( ) ) ;
875+ assert_eq ! ( t!( h. response_code( ) ) , 200 ) ;
876+ assert_eq ! ( t!( h. effective_url( ) ) , Some ( & addr[ ..] ) ) ;
877+ }
You can’t perform that action at this time.
0 commit comments