From 4d1f0c5348f9a59501f81c4d4ce061db309b5d8a Mon Sep 17 00:00:00 2001 From: Marck Date: Mon, 1 Nov 2010 13:36:30 +0100 Subject: [PATCH] Support for CORS with simple requests in BaseHttpServer --- OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index ba8c1941a8..30505f6a5b 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -1450,6 +1450,10 @@ namespace OpenSim.Framework.Servers.HttpServer if (responsedata.ContainsKey("reusecontext")) response.ReuseContext = (bool) responsedata["reusecontext"]; + // Cross-Origin Resource Sharing with simple requests + if (responsedata.ContainsKey("access_control_allow_origin")) + response.AddHeader("Access-Control-Allow-Origin", (string)responsedata["access_control_allow_origin"]); + //Even though only one other part of the entire code uses HTTPHandlers, we shouldn't expect this //and should check for NullReferenceExceptions