@@ -21,9 +21,11 @@ use super::task::{hyper_executor, hyper_task, hyper_task_return_type, AsTaskType
2121/// - hyper_clientconn_options_set_preserve_header_case: Set whether header case is preserved.
2222/// - hyper_clientconn_options_set_preserve_header_order: Set whether header order is preserved.
2323/// - hyper_clientconn_options_http1_allow_multiline_headers: Set whether HTTP/1 connections accept obsolete line folding for header values.
24+ /// - hyper_client_conn_options_http1_allow_spaces_before_first_header: Set whether HTTP/1 connections accept leading whitespaces before first header.
2425/// - hyper_clientconn_options_free: Free a set of HTTP clientconn options.
2526pub struct hyper_clientconn_options {
2627 http1_allow_obsolete_multiline_headers_in_responses : bool ,
28+ http1_allow_spaces_before_first_header_name : bool ,
2729 http1_preserve_header_case : bool ,
2830 http1_preserve_header_order : bool ,
2931 http2 : bool ,
@@ -116,6 +118,7 @@ ffi_fn! {
116118
117119 conn:: http1:: Builder :: new( )
118120 . allow_obsolete_multiline_headers_in_responses( options. http1_allow_obsolete_multiline_headers_in_responses)
121+ . allow_spaces_before_first_header_name( options. http1_allow_spaces_before_first_header_name)
119122 . preserve_header_case( options. http1_preserve_header_case)
120123 . preserve_header_order( options. http1_preserve_header_order)
121124 . handshake:: <_, crate :: body:: Incoming >( io)
@@ -272,4 +275,17 @@ ffi_fn! {
272275 opts. http1_allow_obsolete_multiline_headers_in_responses = enabled != 0 ;
273276 hyper_code:: HYPERE_OK
274277 }
278+
279+ }
280+
281+ ffi_fn ! {
282+ /// Set whether HTTP/1 connections accept leading whitespaces before first header.
283+ ///
284+ /// Pass `0` to disable, `1` to enable.
285+ ///
286+ fn hyper_clientconn_options_http1_allow_spaces_before_first_header_name( opts: * mut hyper_clientconn_options, enabled: c_int) -> hyper_code {
287+ let opts = non_null! { & mut * opts ?= hyper_code:: HYPERE_INVALID_ARG } ;
288+ opts. http1_allow_spaces_before_first_header_name = enabled != 0 ;
289+ hyper_code:: HYPERE_OK
290+ }
275291}
0 commit comments