MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / sandbox_service_routing_only

Function sandbox_service_routing_only

crates/openshell-server/src/http.rs:213–230  ·  view source on GitHub ↗
(
    State(state): State<Arc<crate::ServerState>>,
    req: Request,
)

Source from the content-addressed store, hash-verified

211}
212
213async fn sandbox_service_routing_only(
214 State(state): State<Arc<crate::ServerState>>,
215 req: Request,
216) -> impl IntoResponse {
217 if !crate::service_routing::is_sandbox_service_request(&req, &state.config.service_routing) {
218 return StatusCode::NOT_FOUND.into_response();
219 }
220 if !browser_context_allows_plaintext_service_request(&req) {
221 crate::service_routing::emit_cross_origin_service_http_rejection(&state, &req);
222 return crate::service_routing::service_error_response(
223 StatusCode::FORBIDDEN,
224 "Cross-origin service request rejected",
225 );
226 }
227 crate::service_routing::proxy_sandbox_service_request(state, req)
228 .await
229 .into_response()
230}
231
232fn browser_context_allows_plaintext_service_request(req: &Request) -> bool {
233 if let Some(fetch_site) = header_str(req.headers(), "sec-fetch-site")

Callers

nothing calls this directly

Tested by

no test coverage detected