aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim.RegionServer/CAPS/SimHttp.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim.RegionServer/CAPS/SimHttp.cs143
1 files changed, 74 insertions, 69 deletions
diff --git a/OpenSim.RegionServer/CAPS/SimHttp.cs b/OpenSim.RegionServer/CAPS/SimHttp.cs
index 77c6bb8..c3f4801 100644
--- a/OpenSim.RegionServer/CAPS/SimHttp.cs
+++ b/OpenSim.RegionServer/CAPS/SimHttp.cs
@@ -119,84 +119,89 @@ namespace OpenSim.CAPS
119 private string ParseREST(string requestBody, string requestURL, string requestMethod) 119 private string ParseREST(string requestBody, string requestURL, string requestMethod)
120 { 120 {
121 string responseString = ""; 121 string responseString = "";
122 switch (requestURL) 122 try
123 { 123 {
124 case "/Admin/Accounts": 124 switch (requestURL)
125 if (requestMethod == "GET") 125 {
126 { 126 case "/Admin/Accounts":
127 responseString = "<p> Account management </p>"; 127 if (requestMethod == "GET")
128 responseString += "<br> ";
129 responseString += "<p> Create New Account </p>";
130 responseString += NewAccountForm;
131 }
132 break;
133 case "/Admin/Clients":
134 if (requestMethod == "GET")
135 {
136 responseString = " <p> Listing connected Clients </p>" ;
137 OpenSim.world.Avatar TempAv;
138 foreach (libsecondlife.LLUUID UUID in OpenSimRoot.Instance.LocalWorld.Entities.Keys)
139 { 128 {
140 if (OpenSimRoot.Instance.LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar") 129 responseString = "<p> Account management </p>";
141 { 130 responseString += "<br> ";
142 TempAv = (OpenSim.world.Avatar)OpenSimRoot.Instance.LocalWorld.Entities[UUID]; 131 responseString += "<p> Create New Account </p>";
143 responseString += "<p>"; 132 responseString += NewAccountForm;
144 responseString += String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString());
145 responseString += "</p>";
146 }
147 } 133 }
148 } 134 break;
149 break; 135 case "/Admin/Clients":
150 case "/Admin/NewAccount": 136 if (requestMethod == "GET")
151 if (requestMethod == "POST")
152 {
153 string[] comp = new string[10];
154 string[] passw = new string[3];
155 string delimStr = "&";
156 char[] delimiter = delimStr.ToCharArray();
157 string delimStr2 = "=";
158 char[] delimiter2 = delimStr2.ToCharArray();
159
160 //Console.WriteLine(requestBody);
161 comp = requestBody.Split(delimiter);
162 passw = comp[3].Split(delimiter2);
163 if (passw[1] == passWord)
164 { 137 {
165 responseString = "<p> New Account created </p>"; 138 responseString = " <p> Listing connected Clients </p>";
139 OpenSim.world.Avatar TempAv;
140 foreach (libsecondlife.LLUUID UUID in OpenSimRoot.Instance.LocalWorld.Entities.Keys)
141 {
142 if (OpenSimRoot.Instance.LocalWorld.Entities[UUID].ToString() == "OpenSim.world.Avatar")
143 {
144 TempAv = (OpenSim.world.Avatar)OpenSimRoot.Instance.LocalWorld.Entities[UUID];
145 responseString += "<p>";
146 responseString += String.Format("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}", TempAv.firstname, TempAv.lastname, UUID, TempAv.ControllingClient.SessionID, TempAv.ControllingClient.CircuitCode, TempAv.ControllingClient.userEP.ToString());
147 responseString += "</p>";
148 }
149 }
166 } 150 }
167 else 151 break;
152 case "/Admin/NewAccount":
153 if (requestMethod == "POST")
168 { 154 {
169 responseString = "<p> Admin password is incorrect, please login with the correct password</p>"; 155 string[] comp = new string[10];
170 responseString += "<br><br>" + LoginForm; 156 string[] passw = new string[3];
157 string delimStr = "&";
158 char[] delimiter = delimStr.ToCharArray();
159 string delimStr2 = "=";
160 char[] delimiter2 = delimStr2.ToCharArray();
161
162 //Console.WriteLine(requestBody);
163 comp = requestBody.Split(delimiter);
164 passw = comp[3].Split(delimiter2);
165 if (passw[1] == passWord)
166 {
167 responseString = "<p> New Account created </p>";
168 }
169 else
170 {
171 responseString = "<p> Admin password is incorrect, please login with the correct password</p>";
172 responseString += "<br><br>" + LoginForm;
173 }
171 } 174 }
172 175 break;
173 176 case "/Admin/Login":
174 } 177 if (requestMethod == "POST")
175 break;
176 case "/Admin/Login":
177 if (requestMethod == "POST")
178 {
179 Console.WriteLine(requestBody);
180 if (requestBody == passWord)
181 { 178 {
182 responseString = "<p> Login Successful </p>"; 179 // Console.WriteLine(requestBody);
180 if (requestBody == passWord)
181 {
182 responseString = "<p> Login Successful </p>";
183 }
184 else
185 {
186 responseString = "<p> Password Error </p>";
187 responseString += "<p> Please Login with the correct password </p>";
188 responseString += "<br><br> " + LoginForm;
189 }
183 } 190 }
184 else 191 break;
192 case "/Admin/Welcome":
193 if (requestMethod == "GET")
185 { 194 {
186 responseString = "<p> PassWord Error </p>"; 195 responseString = "Welcome to the OpenSim Admin Page";
187 responseString += "<p> Please Login with the correct password </p>"; 196 responseString += "<br><br><br> " + LoginForm;
188 responseString += "<br><br> " + LoginForm;
189 }
190 }
191 break;
192 case "/Admin/Welcome":
193 if (requestMethod == "GET")
194 {
195 responseString = "Welcome to the OpenSim Admin Page";
196 responseString += "<br><br><br> " + LoginForm;
197 197
198 } 198 }
199 break; 199 break;
200 }
201 }
202 catch (Exception e)
203 {
204 Console.WriteLine(e.ToString());
200 } 205 }
201 206
202 return responseString; 207 return responseString;
@@ -210,7 +215,7 @@ namespace OpenSim.CAPS
210 215
211 public void HandleRequest(Object stateinfo) 216 public void HandleRequest(Object stateinfo)
212 { 217 {
213 // Console.WriteLine("new http incoming"); 218 // Console.WriteLine("new http incoming");
214 HttpListenerContext context = (HttpListenerContext)stateinfo; 219 HttpListenerContext context = (HttpListenerContext)stateinfo;
215 220
216 HttpListenerRequest request = context.Request; 221 HttpListenerRequest request = context.Request;
@@ -265,7 +270,7 @@ namespace OpenSim.CAPS
265 response.AddHeader("Content-type", "text/html"); 270 response.AddHeader("Content-type", "text/html");
266 } 271 }
267 break; 272 break;
268 273
269 } 274 }
270 275
271 byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString); 276 byte[] buffer = System.Text.Encoding.UTF8.GetBytes(responseString);