/// An options builder to configure an HTTP client connection. pubstruct hyper_clientconn_options {
builder: conn::Builder, /// Use a `Weak` to prevent cycles.
exec: WeakExec,
}
/// An HTTP client connection handle. /// /// These are used to send a request on a single connection. It's possible to /// send multiple requests on a single connection, such as when HTTP/1 /// keep-alive or HTTP/2 is used. pubstruct hyper_clientconn {
tx: conn::SendRequest<crate::Body>,
}
// ===== impl hyper_clientconn =====
ffi_fn! { /// Starts an HTTP client connection handshake using the provided IO transport /// and options. /// /// Both the `io` and the `options` are consumed in this function call. /// /// The returned `hyper_task *` must be polled with an executor until the /// handshake completes, at which point the value can be taken. fn hyper_clientconn_handshake(io: *mut hyper_io, options: *mut hyper_clientconn_options) -> *mut hyper_task { let options = non_null! { Box::from_raw(options) ?= ptr::null_mut() }; let io = non_null! { Box::from_raw(io) ?= ptr::null_mut() };
ffi_fn! { /// Send a request on the client connection. /// /// Returns a task that needs to be polled until it is ready. When ready, the /// task yields a `hyper_response *`. fn hyper_clientconn_send(conn: *mut hyper_clientconn, req: *mut hyper_request) -> *mut hyper_task { letmut req = non_null! { Box::from_raw(req) ?= ptr::null_mut() };
// Update request with original-case map of headers
req.finalize_request();
let fut = non_null! { &mut *conn ?= ptr::null_mut() }.tx.send_request(req.0);
let fut = asyncmove {
fut.await.map(hyper_response::wrap)
};
ffi_fn! { /// Creates a new set of HTTP clientconn options to be used in a handshake. fn hyper_clientconn_options_new() -> *mut hyper_clientconn_options { let builder = conn::Builder::new();
ffi_fn! { /// Set the whether or not header case is preserved. /// /// Pass `0` to allow lowercase normalization (default), `1` to retain original case. fn hyper_clientconn_options_set_preserve_header_case(opts: *mut hyper_clientconn_options, enabled: c_int) { let opts = non_null! { &mut *opts ?= () };
opts.builder.http1_preserve_header_case(enabled != 0);
}
}
ffi_fn! { /// Set the whether or not header order is preserved. /// /// Pass `0` to allow reordering (default), `1` to retain original ordering. fn hyper_clientconn_options_set_preserve_header_order(opts: *mut hyper_clientconn_options, enabled: c_int) { let opts = non_null! { &mut *opts ?= () };
opts.builder.http1_preserve_header_order(enabled != 0);
}
}
ffi_fn! { /// Set the client background task executor. /// /// This does not consume the `options` or the `exec`. fn hyper_clientconn_options_exec(opts: *mut hyper_clientconn_options, exec: *const hyper_executor) { let opts = non_null! { &mut *opts ?= () };
let exec = non_null! { Arc::from_raw(exec) ?= () }; let weak_exec = hyper_executor::downgrade(&exec);
std::mem::forget(exec);
ffi_fn! { /// Set the whether to include a copy of the raw headers in responses /// received on this connection. /// /// Pass `0` to disable, `1` to enable. /// /// If enabled, see `hyper_response_headers_raw()` for usage. fn hyper_clientconn_options_headers_raw(opts: *mut hyper_clientconn_options, enabled: c_int) -> hyper_code { let opts = non_null! { &mut *opts ?= hyper_code::HYPERE_INVALID_ARG };
opts.builder.http1_headers_raw(enabled != 0);
hyper_code::HYPERE_OK
}
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.21 Sekunden
(vorverarbeitet am 2026-06-18)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.