Skip to content

Commit 2d2461a

Browse files
committed
Refactor(ffi): remove the "raw" headers option in C API
1 parent bd7928f commit 2d2461a

File tree

4 files changed

+0
-67
lines changed

4 files changed

+0
-67
lines changed

capi/examples/upload.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,6 @@ static void print_informational(void *userdata, hyper_response *resp) {
153153
uint16_t http_status = hyper_response_status(resp);
154154

155155
printf("\nInformational (1xx): %d\n", http_status);
156-
157-
const hyper_buf *headers = hyper_response_headers_raw(resp);
158-
if (headers) {
159-
write(1, hyper_buf_bytes(headers), hyper_buf_len(headers));
160-
}
161156
}
162157

163158
typedef enum {
@@ -228,7 +223,6 @@ int main(int argc, char *argv[]) {
228223
// Prepare client options
229224
hyper_clientconn_options *opts = hyper_clientconn_options_new();
230225
hyper_clientconn_options_exec(opts, exec);
231-
hyper_clientconn_options_headers_raw(opts, 1);
232226

233227
hyper_task *handshake = hyper_clientconn_handshake(io, opts);
234228
hyper_task_set_userdata(handshake, (void *)EXAMPLE_HANDSHAKE);

capi/include/hyper.h

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -391,17 +391,6 @@ void hyper_clientconn_options_exec(struct hyper_clientconn_options *opts,
391391
*/
392392
enum hyper_code hyper_clientconn_options_http2(struct hyper_clientconn_options *opts, int enabled);
393393

394-
/*
395-
Set the whether to include a copy of the raw headers in responses
396-
received on this connection.
397-
398-
Pass `0` to disable, `1` to enable.
399-
400-
If enabled, see `hyper_response_headers_raw()` for usage.
401-
*/
402-
enum hyper_code hyper_clientconn_options_headers_raw(struct hyper_clientconn_options *opts,
403-
int enabled);
404-
405394
/*
406395
Set whether HTTP/1 connections will accept obsolete line folding for header values.
407396
Newline codepoints (\r and \n) will be transformed to spaces when parsing.
@@ -567,21 +556,6 @@ const uint8_t *hyper_response_reason_phrase(const struct hyper_response *resp);
567556
*/
568557
size_t hyper_response_reason_phrase_len(const struct hyper_response *resp);
569558

570-
/*
571-
Get a reference to the full raw headers of this response.
572-
573-
You must have enabled `hyper_clientconn_options_headers_raw()`, or this
574-
will return NULL.
575-
576-
The returned `hyper_buf *` is just a reference, owned by the response.
577-
You need to make a copy if you wish to use it after freeing the
578-
response.
579-
580-
The buffer is not null-terminated, see the `hyper_buf` functions for
581-
getting the bytes and length.
582-
*/
583-
const struct hyper_buf *hyper_response_headers_raw(const struct hyper_response *resp);
584-
585559
/*
586560
Get the HTTP version used by this response.
587561

src/ffi/client.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -203,20 +203,6 @@ ffi_fn! {
203203
}
204204
}
205205

206-
ffi_fn! {
207-
/// Set the whether to include a copy of the raw headers in responses
208-
/// received on this connection.
209-
///
210-
/// Pass `0` to disable, `1` to enable.
211-
///
212-
/// If enabled, see `hyper_response_headers_raw()` for usage.
213-
fn hyper_clientconn_options_headers_raw(opts: *mut hyper_clientconn_options, enabled: c_int) -> hyper_code {
214-
let opts = non_null! { &mut *opts ?= hyper_code::HYPERE_INVALID_ARG };
215-
opts.http1_headers_raw = enabled != 0;
216-
hyper_code::HYPERE_OK
217-
}
218-
}
219-
220206
ffi_fn! {
221207
/// Set whether HTTP/1 connections will accept obsolete line folding for header values.
222208
/// Newline codepoints (\r and \n) will be transformed to spaces when parsing.

src/ffi/http_types.rs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -278,27 +278,6 @@ ffi_fn! {
278278
}
279279
}
280280

281-
ffi_fn! {
282-
/// Get a reference to the full raw headers of this response.
283-
///
284-
/// You must have enabled `hyper_clientconn_options_headers_raw()`, or this
285-
/// will return NULL.
286-
///
287-
/// The returned `hyper_buf *` is just a reference, owned by the response.
288-
/// You need to make a copy if you wish to use it after freeing the
289-
/// response.
290-
///
291-
/// The buffer is not null-terminated, see the `hyper_buf` functions for
292-
/// getting the bytes and length.
293-
fn hyper_response_headers_raw(resp: *const hyper_response) -> *const hyper_buf {
294-
let resp = non_null!(&*resp ?= std::ptr::null());
295-
match resp.0.extensions().get::<RawHeaders>() {
296-
Some(raw) => &raw.0,
297-
None => std::ptr::null(),
298-
}
299-
} ?= std::ptr::null()
300-
}
301-
302281
ffi_fn! {
303282
/// Get the HTTP version used by this response.
304283
///

0 commit comments

Comments
 (0)