Skip to content

Commit 09e3566

Browse files
authored
feat(ffi): add http1_allow_multiline_headers (#2918)
1 parent 3660443 commit 09e3566

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

capi/include/hyper.h

+10
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,16 @@ enum hyper_code hyper_clientconn_options_http2(struct hyper_clientconn_options *
402402
enum hyper_code hyper_clientconn_options_headers_raw(struct hyper_clientconn_options *opts,
403403
int enabled);
404404

405+
/*
406+
Set whether HTTP/1 connections will accept obsolete line folding for header values.
407+
Newline codepoints (\r and \n) will be transformed to spaces when parsing.
408+
409+
Pass `0` to disable, `1` to enable.
410+
411+
*/
412+
enum hyper_code hyper_clientconn_options_http1_allow_multiline_headers(struct hyper_clientconn_options *opts,
413+
int enabled);
414+
405415
/*
406416
Frees a `hyper_error`.
407417
*/

src/ffi/client.rs

+13
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,16 @@ ffi_fn! {
179179
hyper_code::HYPERE_OK
180180
}
181181
}
182+
183+
ffi_fn! {
184+
/// Set whether HTTP/1 connections will accept obsolete line folding for header values.
185+
/// Newline codepoints (\r and \n) will be transformed to spaces when parsing.
186+
///
187+
/// Pass `0` to disable, `1` to enable.
188+
///
189+
fn hyper_clientconn_options_http1_allow_multiline_headers(opts: *mut hyper_clientconn_options, enabled: c_int) -> hyper_code {
190+
let opts = non_null! { &mut *opts ?= hyper_code::HYPERE_INVALID_ARG };
191+
opts.builder.http1_allow_obsolete_multiline_headers_in_responses(enabled != 0);
192+
hyper_code::HYPERE_OK
193+
}
194+
}

0 commit comments

Comments
 (0)