@@ -112,7 +112,7 @@ async fn send_request_impl(
112112 let is_relative_url = request. uri ( ) . authority ( ) . is_none ( ) ;
113113 if is_relative_url {
114114 if !allowed_hosts. allows_relative_url ( & [ "http" , "https" ] ) {
115- return handle_not_allowed ( request. uri ( ) , true ) ;
115+ return Ok ( handle_not_allowed ( request. uri ( ) , true ) ) ;
116116 }
117117
118118 let origin = request
@@ -131,7 +131,7 @@ async fn send_request_impl(
131131 let outbound_url = OutboundUrl :: parse ( request. uri ( ) . to_string ( ) , "https" )
132132 . map_err ( |_| ErrorCode :: HttpRequestUriInvalid ) ?;
133133 if !allowed_hosts. allows ( & outbound_url) {
134- return handle_not_allowed ( request. uri ( ) , false ) ;
134+ return Ok ( handle_not_allowed ( request. uri ( ) , false ) ) ;
135135 }
136136 }
137137
@@ -147,11 +147,8 @@ async fn send_request_impl(
147147}
148148
149149// TODO(factors): Move to some callback on spin-factor-outbound-networking (?)
150- fn handle_not_allowed (
151- uri : & Uri ,
152- is_relative : bool ,
153- ) -> anyhow:: Result < Result < IncomingResponse , ErrorCode > > {
154- tracing:: error!( "Destination not allowed: {uri}" ) ;
150+ fn handle_not_allowed ( uri : & Uri , is_relative : bool ) -> Result < IncomingResponse , ErrorCode > {
151+ tracing:: error!( "Destination not allowed!: {uri}" ) ;
155152 let allowed_host_example = if is_relative {
156153 terminal:: warn!( "A component tried to make a HTTP request to the same component but it does not have permission." ) ;
157154 "http://self" . to_string ( )
@@ -165,7 +162,7 @@ fn handle_not_allowed(
165162 host
166163 } ;
167164 eprintln ! ( "To allow requests, add 'allowed_outbound_hosts = [\" {allowed_host_example}\" ]' to the manifest component section." ) ;
168- Err ( ErrorCode :: HttpRequestDenied . into ( ) )
165+ Err ( ErrorCode :: HttpRequestDenied )
169166}
170167
171168/// This is a fork of wasmtime_wasi_http::default_send_request_handler function
0 commit comments