@@ -90,6 +90,54 @@ ffi_fn! {
90
90
}
91
91
}
92
92
93
+ ffi_fn ! {
94
+ /// Set the URI of the request with separate scheme, authority, and
95
+ /// path/query strings.
96
+ ///
97
+ /// Each of `scheme`, `authority`, and `path_and_query` should either be
98
+ /// null, to skip providing a component, or point to a UTF-8 encoded
99
+ /// string. If any string pointer argument is non-null, its corresponding
100
+ /// `len` parameter must be set to the string's length.
101
+ fn hyper_request_set_uri_parts(
102
+ req: * mut hyper_request,
103
+ scheme: * const u8 ,
104
+ scheme_len: size_t,
105
+ authority: * const u8 ,
106
+ authority_len: size_t,
107
+ path_and_query: * const u8 ,
108
+ path_and_query_len: size_t
109
+ ) -> hyper_code {
110
+ let mut builder = Uri :: builder( ) ;
111
+ if !scheme. is_null( ) {
112
+ let scheme_bytes = unsafe {
113
+ std:: slice:: from_raw_parts( scheme, scheme_len as usize )
114
+ } ;
115
+ builder = builder. scheme( scheme_bytes) ;
116
+ }
117
+ if !authority. is_null( ) {
118
+ let authority_bytes = unsafe {
119
+ std:: slice:: from_raw_parts( authority, authority_len as usize )
120
+ } ;
121
+ builder = builder. authority( authority_bytes) ;
122
+ }
123
+ if !path_and_query. is_null( ) {
124
+ let path_and_query_bytes = unsafe {
125
+ std:: slice:: from_raw_parts( path_and_query, path_and_query_len as usize )
126
+ } ;
127
+ builder = builder. path_and_query( path_and_query_bytes) ;
128
+ }
129
+ match builder. build( ) {
130
+ Ok ( u) => {
131
+ * unsafe { & mut * req } . 0 . uri_mut( ) = u;
132
+ hyper_code:: HYPERE_OK
133
+ } ,
134
+ Err ( _) => {
135
+ hyper_code:: HYPERE_INVALID_ARG
136
+ }
137
+ }
138
+ }
139
+ }
140
+
93
141
ffi_fn ! {
94
142
/// Set the preferred HTTP version of the request.
95
143
///
0 commit comments