Skip to content

Commit 09e3566

Browse files
authoredJul 19, 2022
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+
}

1 commit comments

Comments
 (1)

github-actions[bot] commented on Jul 19, 2022

@github-actions[bot]

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'end_to_end'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 09e3566 Previous: 3660443 Ratio
http2_parallel_x10_req_10kb_100_chunks_adaptive_window 18322671 ns/iter (± 8623329) 8806869 ns/iter (± 40294) 2.08

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.