Skip to content

Commit

Permalink
feat(ffi): add http1_allow_multiline_headers (#2918)
Browse files Browse the repository at this point in the history
  • Loading branch information
deantvv authored Jul 19, 2022
1 parent 3660443 commit 09e3566
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
10 changes: 10 additions & 0 deletions capi/include/hyper.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,16 @@ enum hyper_code hyper_clientconn_options_http2(struct hyper_clientconn_options *
enum hyper_code hyper_clientconn_options_headers_raw(struct hyper_clientconn_options *opts,
int enabled);

/*
Set whether HTTP/1 connections will accept obsolete line folding for header values.
Newline codepoints (\r and \n) will be transformed to spaces when parsing.
Pass `0` to disable, `1` to enable.
*/
enum hyper_code hyper_clientconn_options_http1_allow_multiline_headers(struct hyper_clientconn_options *opts,
int enabled);

/*
Frees a `hyper_error`.
*/
Expand Down
13 changes: 13 additions & 0 deletions src/ffi/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,16 @@ ffi_fn! {
hyper_code::HYPERE_OK
}
}

ffi_fn! {
/// Set whether HTTP/1 connections will accept obsolete line folding for header values.
/// Newline codepoints (\r and \n) will be transformed to spaces when parsing.
///
/// Pass `0` to disable, `1` to enable.
///
fn hyper_clientconn_options_http1_allow_multiline_headers(opts: *mut hyper_clientconn_options, enabled: c_int) -> hyper_code {
let opts = non_null! { &mut *opts ?= hyper_code::HYPERE_INVALID_ARG };
opts.builder.http1_allow_obsolete_multiline_headers_in_responses(enabled != 0);
hyper_code::HYPERE_OK
}
}

1 comment on commit 09e3566

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ 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.