aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2017-04-26 07:19:44 +0100
committerUbitUmarov2017-04-26 07:19:44 +0100
commitce3af94a693aa05e90416649f832f36b62630c69 (patch)
tree3a82e7f115da47508eb61fafd729be7d913192af
parentIf we're going to show regions twice (in standalone) at least make the format... (diff)
downloadopensim-SC-ce3af94a693aa05e90416649f832f36b62630c69.zip
opensim-SC-ce3af94a693aa05e90416649f832f36b62630c69.tar.gz
opensim-SC-ce3af94a693aa05e90416649f832f36b62630c69.tar.bz2
opensim-SC-ce3af94a693aa05e90416649f832f36b62630c69.tar.xz
mantis 6738: change parsing of the HTTP_CUSTOM_HEADER parameter and ignore entries in excess of 8 on the request
-rw-r--r--OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs12
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs13
2 files changed, 14 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
index 09891f7..035097f 100644
--- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
@@ -223,20 +223,16 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
223 if (parms.Length - i < 2) 223 if (parms.Length - i < 2)
224 break; 224 break;
225 225
226 //Have we reached the end of the list of headers?
227 //End is marked by a string with a single digit.
228 //We already know we have at least one parameter
229 //so it is safe to do this check at top of loop.
230 if (Char.IsDigit(parms[i][0]))
231 break;
232
233 if (htc.HttpCustomHeaders == null) 226 if (htc.HttpCustomHeaders == null)
234 htc.HttpCustomHeaders = new List<string>(); 227 htc.HttpCustomHeaders = new List<string>();
235 228
236 htc.HttpCustomHeaders.Add(parms[i]); 229 htc.HttpCustomHeaders.Add(parms[i]);
237 htc.HttpCustomHeaders.Add(parms[i+1]); 230 htc.HttpCustomHeaders.Add(parms[i+1]);
231 int nexti = i + 2;
232 if (nexti >= parms.Length || Char.IsDigit(parms[nexti][0]))
233 break;
238 234
239 i += 2; 235 i = nexti;
240 } 236 }
241 break; 237 break;
242 238
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 47c3cb8..2000c44 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -13405,6 +13405,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13405 List<string> param = new List<string>(); 13405 List<string> param = new List<string>();
13406 bool ok; 13406 bool ok;
13407 Int32 flag; 13407 Int32 flag;
13408 int nCustomHeaders = 0;
13408 13409
13409 for (int i = 0; i < parameters.Data.Length; i += 2) 13410 for (int i = 0; i < parameters.Data.Length; i += 2)
13410 { 13411 {
@@ -13431,6 +13432,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13431 //Second Life documentation for llHTTPRequest. 13432 //Second Life documentation for llHTTPRequest.
13432 for (int count = 1; count <= 8; ++count) 13433 for (int count = 1; count <= 8; ++count)
13433 { 13434 {
13435 if(nCustomHeaders >= 8)
13436 {
13437 Error("llHTTPRequest", "Max number of custom headers is 8, excess ignored");
13438 break;
13439 }
13440
13434 //Enough parameters remaining for (another) header? 13441 //Enough parameters remaining for (another) header?
13435 if (parameters.Data.Length - i < 2) 13442 if (parameters.Data.Length - i < 2)
13436 { 13443 {
@@ -13445,15 +13452,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
13445 13452
13446 param.Add(parameters.Data[i].ToString()); 13453 param.Add(parameters.Data[i].ToString());
13447 param.Add(parameters.Data[i+1].ToString()); 13454 param.Add(parameters.Data[i+1].ToString());
13455 nCustomHeaders++;
13448 13456
13449 //Have we reached the end of the list of headers? 13457 //Have we reached the end of the list of headers?
13450 //End is marked by a string with a single digit. 13458 //End is marked by a string with a single digit.
13451 if (i+2 >= parameters.Data.Length || 13459 if (i + 2 >= parameters.Data.Length ||
13452 Char.IsDigit(parameters.Data[i].ToString()[0])) 13460 Char.IsDigit(parameters.Data[i + 2].ToString()[0]))
13453 { 13461 {
13454 break; 13462 break;
13455 } 13463 }
13456
13457 i += 2; 13464 i += 2;
13458 } 13465 }
13459 } 13466 }