Skip to content

Commit d64ea76

Browse files
committed
add client_tls_opts to HttpRuntimeData
Signed-off-by: Rajat Jindal <[email protected]>
1 parent 5d96bdd commit d64ea76

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

crates/trigger-http/src/handler.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ impl HttpExecutor for HttpHandlerExecutor {
4848

4949
set_http_origin_from_request(&mut store, engine.clone(), self, &req);
5050

51+
// set the client tls options for the current component_id.
52+
// The OutboundWasiHttpHandler in this file is only used
53+
// when making http-request from a http-trigger component.
54+
// The outbound http requests from other triggers such as Redis
55+
// uses OutboundWasiHttpHandler defined in spin_core crate.
56+
store.as_mut().data_mut().as_mut().client_tls_opts = engine.get_client_tls_opts(component_id);
57+
5158
let resp = match ty {
5259
HandlerType::Spin => {
5360
Self::execute_spin(store, instance, base, route_match, req, client_addr)

crates/trigger-http/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use spin_http::{
3939
use spin_outbound_networking::{
4040
is_service_chaining_host, parse_service_chaining_target, AllowedHostsConfig, OutboundUrl,
4141
};
42-
use spin_trigger::{TriggerAppEngine, TriggerExecutor, TriggerInstancePre};
42+
use spin_trigger::{ParsedClientTlsOpts, TriggerAppEngine, TriggerExecutor, TriggerInstancePre};
4343
use tokio::{
4444
io::{AsyncRead, AsyncWrite},
4545
net::{TcpListener, TcpStream},
@@ -586,6 +586,8 @@ struct ChainedRequestHandler {
586586
pub struct HttpRuntimeData {
587587
origin: Option<String>,
588588
chained_handler: Option<ChainedRequestHandler>,
589+
/// If provided, these options used for client cert auth
590+
client_tls_opts: Option<HashMap<String, ParsedClientTlsOpts>>,
589591
/// The hosts this app is allowed to make outbound requests to
590592
allowed_hosts: AllowedHostsConfig,
591593
}

0 commit comments

Comments
 (0)