aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/CAPS/SimHttp.cs
diff options
context:
space:
mode:
authorMW2007-03-15 12:44:06 +0000
committerMW2007-03-15 12:44:06 +0000
commit1260e35ca824aed8042f5b83bca487f1483815dd (patch)
tree8810014da90e24d7954816417a5bfa5a87a6fcca /src/CAPS/SimHttp.cs
parentCreated VS2005 Solution/Project files for the OGS apps (diff)
downloadopensim-SC_OLD-1260e35ca824aed8042f5b83bca487f1483815dd.zip
opensim-SC_OLD-1260e35ca824aed8042f5b83bca487f1483815dd.tar.gz
opensim-SC_OLD-1260e35ca824aed8042f5b83bca487f1483815dd.tar.bz2
opensim-SC_OLD-1260e35ca824aed8042f5b83bca487f1483815dd.tar.xz
Diffstat (limited to '')
-rw-r--r--src/CAPS/SimHttp.cs88
1 files changed, 45 insertions, 43 deletions
diff --git a/src/CAPS/SimHttp.cs b/src/CAPS/SimHttp.cs
index 12bc9a8..c0373de 100644
--- a/src/CAPS/SimHttp.cs
+++ b/src/CAPS/SimHttp.cs
@@ -76,27 +76,30 @@ namespace OpenSim
76 } 76 }
77 77
78 static string ParseXMLRPC(string requestBody) { 78 static string ParseXMLRPC(string requestBody) {
79 try{ 79 try
80 XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody); 80 {
81 81 XmlRpcRequest request = (XmlRpcRequest)(new XmlRpcRequestDeserializer()).Deserialize(requestBody);
82 Hashtable requestData = (Hashtable)request.Params[0]; 82
83 switch(request.MethodName) { 83 Hashtable requestData = (Hashtable)request.Params[0];
84 case "expect_user": 84 switch(request.MethodName) {
85 GridServers.agentcircuitdata agent_data = new GridServers.agentcircuitdata(); 85 case "expect_user":
86 agent_data.SessionID = new LLUUID((string)requestData["session_id"]); 86 GridServers.agentcircuitdata agent_data = new GridServers.agentcircuitdata();
87 agent_data.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]); 87 agent_data.SessionID = new LLUUID((string)requestData["session_id"]);
88 agent_data.firstname = (string)requestData["firstname"]; 88 agent_data.SecureSessionID = new LLUUID((string)requestData["secure_session_id"]);
89 agent_data.lastname = (string)requestData["lastname"]; 89 agent_data.firstname = (string)requestData["firstname"];
90 agent_data.AgentID = new LLUUID((string)requestData["agent_id"]); 90 agent_data.lastname = (string)requestData["lastname"];
91 agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]); 91 agent_data.AgentID = new LLUUID((string)requestData["agent_id"]);
92 if (OpenSim_Main.gridServers.GridServer.GetName() == "Remote") 92 agent_data.circuitcode = Convert.ToUInt32(requestData["circuit_code"]);
93 { 93 if (OpenSim_Main.gridServers.GridServer.GetName() == "Remote")
94 ((RemoteGridBase) OpenSim_Main.gridServers.GridServer).agentcircuits.Add((uint)agent_data.circuitcode,agent_data); 94 {
95 } 95 ((RemoteGridBase) OpenSim_Main.gridServers.GridServer).agentcircuits.Add((uint)agent_data.circuitcode,agent_data);
96 return "<?xml version=\"1.0\"?><methodResponse><params /></methodResponse>"; 96 }
97 break; 97 return "<?xml version=\"1.0\"?><methodResponse><params /></methodResponse>";
98 } 98 break;
99 } catch(Exception e) { 99 }
100 }
101 catch(Exception e)
102 {
100 Console.WriteLine(e.ToString()); 103 Console.WriteLine(e.ToString());
101 } 104 }
102 return ""; 105 return "";
@@ -113,49 +116,48 @@ namespace OpenSim
113 116
114 static void HandleRequest(Object stateinfo) { 117 static void HandleRequest(Object stateinfo) {
115 HttpListenerContext context=(HttpListenerContext)stateinfo; 118 HttpListenerContext context=(HttpListenerContext)stateinfo;
116 119
117 HttpListenerRequest request = context.Request; 120 HttpListenerRequest request = context.Request;
118 HttpListenerResponse response = context.Response; 121 HttpListenerResponse response = context.Response;
119 122
120 response.KeepAlive=false; 123 response.KeepAlive=false;
121 response.SendChunked=false; 124 response.SendChunked=false;
122 125
123 System.IO.Stream body = request.InputStream; 126 System.IO.Stream body = request.InputStream;
124 System.Text.Encoding encoding = System.Text.Encoding.UTF8; 127 System.Text.Encoding encoding = System.Text.Encoding.UTF8;
125 System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding); 128 System.IO.StreamReader reader = new System.IO.StreamReader(body, encoding);
126 129
127 string requestBody = reader.ReadToEnd(); 130 string requestBody = reader.ReadToEnd();
128 body.Close(); 131 body.Close();
129 reader.Close(); 132 reader.Close();
130 133
131 string responseString=""; 134 string responseString="";
132 switch(request.ContentType) { 135 switch(request.ContentType) {
133 case "text/xml": 136 case "text/xml":
134 // must be XML-RPC, so pass to the XML-RPC parser 137 // must be XML-RPC, so pass to the XML-RPC parser
135 138
136 responseString=ParseXMLRPC(requestBody); 139 responseString=ParseXMLRPC(requestBody);
137 response.AddHeader("Content-type","text/xml"); 140 response.AddHeader("Content-type","text/xml");
138 break; 141 break;
139 142
140 case "application/xml": 143 case "application/xml":
141 // probably LLSD we hope, otherwise it should be ignored by the parser 144 // probably LLSD we hope, otherwise it should be ignored by the parser
142 responseString=ParseLLSDXML(requestBody); 145 responseString=ParseLLSDXML(requestBody);
143 response.AddHeader("Content-type","application/xml"); 146 response.AddHeader("Content-type","application/xml");
144 break; 147 break;
145 148
146 case null: 149 case null:
147 // must be REST or invalid crap, so pass to the REST parser 150 // must be REST or invalid crap, so pass to the REST parser
148 responseString=ParseREST(request.Url.OriginalString,requestBody); 151 responseString=ParseREST(request.Url.OriginalString,requestBody);
149 break; 152 break;
150 } 153 }
151 154
152 155 byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString);
153 byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString); 156 System.IO.Stream output = response.OutputStream;
154 System.IO.Stream output = response.OutputStream; 157 response.SendChunked=false;
155 response.SendChunked=false;
156 response.ContentLength64=buffer.Length; 158 response.ContentLength64=buffer.Length;
157 output.Write(buffer,0,buffer.Length); 159 output.Write(buffer,0,buffer.Length);
158 output.Close(); 160 output.Close();
159 } 161 }
160 } 162 }
161 163