diff options
author | Melanie Thielker | 2017-01-05 19:07:37 +0000 |
---|---|---|
committer | Melanie Thielker | 2017-01-05 19:07:37 +0000 |
commit | b16abc8166c29585cb76cc55c3bdd76e5833cb4f (patch) | |
tree | 6a34f465a74b7a3a6dc00a3d7aa8dcc25ac3e3a5 /OpenSim/Framework/WebUtil.cs | |
parent | Make it possible to disable the bakes module in the way it is described in co... (diff) | |
download | opensim-SC_OLD-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.zip opensim-SC_OLD-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.tar.gz opensim-SC_OLD-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.tar.bz2 opensim-SC_OLD-b16abc8166c29585cb76cc55c3bdd76e5833cb4f.tar.xz |
Massive tab and trailing space cleanup
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/WebUtil.cs | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index f927e69..12f58fe 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs | |||
@@ -247,7 +247,7 @@ namespace OpenSim.Framework | |||
247 | request.MaximumAutomaticRedirections = 10; | 247 | request.MaximumAutomaticRedirections = 10; |
248 | request.ReadWriteTimeout = timeout / 4; | 248 | request.ReadWriteTimeout = timeout / 4; |
249 | request.Headers[OSHeaderRequestID] = reqnum.ToString(); | 249 | request.Headers[OSHeaderRequestID] = reqnum.ToString(); |
250 | 250 | ||
251 | // If there is some input, write it into the request | 251 | // If there is some input, write it into the request |
252 | if (data != null) | 252 | if (data != null) |
253 | { | 253 | { |
@@ -261,7 +261,7 @@ namespace OpenSim.Framework | |||
261 | byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer); | 261 | byte[] buffer = System.Text.Encoding.UTF8.GetBytes(strBuffer); |
262 | 262 | ||
263 | request.ContentType = rpc ? "application/json-rpc" : "application/json"; | 263 | request.ContentType = rpc ? "application/json-rpc" : "application/json"; |
264 | 264 | ||
265 | if (compressed) | 265 | if (compressed) |
266 | { | 266 | { |
267 | request.Headers["X-Content-Encoding"] = "gzip"; // can't set "Content-Encoding" because old OpenSims fail if they get an unrecognized Content-Encoding | 267 | request.Headers["X-Content-Encoding"] = "gzip"; // can't set "Content-Encoding" because old OpenSims fail if they get an unrecognized Content-Encoding |
@@ -294,7 +294,7 @@ namespace OpenSim.Framework | |||
294 | requestStream.Write(buffer, 0, buffer.Length); //Send it | 294 | requestStream.Write(buffer, 0, buffer.Length); //Send it |
295 | } | 295 | } |
296 | } | 296 | } |
297 | 297 | ||
298 | // capture how much time was spent writing, this may seem silly | 298 | // capture how much time was spent writing, this may seem silly |
299 | // but with the number concurrent requests, this often blocks | 299 | // but with the number concurrent requests, this often blocks |
300 | tickdata = Util.EnvironmentTickCountSubtract(tickstart); | 300 | tickdata = Util.EnvironmentTickCountSubtract(tickstart); |
@@ -354,7 +354,7 @@ namespace OpenSim.Framework | |||
354 | reqnum, tickdiff, tickdata); | 354 | reqnum, tickdiff, tickdata); |
355 | } | 355 | } |
356 | } | 356 | } |
357 | 357 | ||
358 | m_log.DebugFormat( | 358 | m_log.DebugFormat( |
359 | "[LOGHTTP]: JSON-RPC request {0} {1} to {2} FAILED: {3}", reqnum, method, url, errorMessage); | 359 | "[LOGHTTP]: JSON-RPC request {0} {1} to {2} FAILED: {3}", reqnum, method, url, errorMessage); |
360 | 360 | ||
@@ -378,7 +378,7 @@ namespace OpenSim.Framework | |||
378 | result["success"] = OSD.FromBoolean(true); | 378 | result["success"] = OSD.FromBoolean(true); |
379 | result["_RawResult"] = OSD.FromString(response); | 379 | result["_RawResult"] = OSD.FromString(response); |
380 | result["_Result"] = new OSDMap(); | 380 | result["_Result"] = new OSDMap(); |
381 | 381 | ||
382 | if (response.Equals("true",System.StringComparison.OrdinalIgnoreCase)) | 382 | if (response.Equals("true",System.StringComparison.OrdinalIgnoreCase)) |
383 | return result; | 383 | return result; |
384 | 384 | ||
@@ -389,7 +389,7 @@ namespace OpenSim.Framework | |||
389 | return result; | 389 | return result; |
390 | } | 390 | } |
391 | 391 | ||
392 | try | 392 | try |
393 | { | 393 | { |
394 | OSD responseOSD = OSDParser.Deserialize(response); | 394 | OSD responseOSD = OSDParser.Deserialize(response); |
395 | if (responseOSD.Type == OSDType.Map) | 395 | if (responseOSD.Type == OSDType.Map) |
@@ -403,10 +403,10 @@ namespace OpenSim.Framework | |||
403 | // don't need to treat this as an error... we're just guessing anyway | 403 | // don't need to treat this as an error... we're just guessing anyway |
404 | // m_log.DebugFormat("[WEB UTIL] couldn't decode <{0}>: {1}",response,e.Message); | 404 | // m_log.DebugFormat("[WEB UTIL] couldn't decode <{0}>: {1}",response,e.Message); |
405 | } | 405 | } |
406 | 406 | ||
407 | return result; | 407 | return result; |
408 | } | 408 | } |
409 | 409 | ||
410 | #endregion JSONRequest | 410 | #endregion JSONRequest |
411 | 411 | ||
412 | #region FormRequest | 412 | #region FormRequest |
@@ -419,7 +419,7 @@ namespace OpenSim.Framework | |||
419 | { | 419 | { |
420 | return ServiceFormRequest(url,data, 30000); | 420 | return ServiceFormRequest(url,data, 30000); |
421 | } | 421 | } |
422 | 422 | ||
423 | public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout) | 423 | public static OSDMap ServiceFormRequest(string url, NameValueCollection data, int timeout) |
424 | { | 424 | { |
425 | lock (EndPointLock(url)) | 425 | lock (EndPointLock(url)) |
@@ -436,7 +436,7 @@ namespace OpenSim.Framework | |||
436 | if (DebugLevel >= 3) | 436 | if (DebugLevel >= 3) |
437 | m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} ServiceForm '{1}' to {2}", | 437 | m_log.DebugFormat("[LOGHTTP]: HTTP OUT {0} ServiceForm '{1}' to {2}", |
438 | reqnum, method, url); | 438 | reqnum, method, url); |
439 | 439 | ||
440 | string errorMessage = "unknown error"; | 440 | string errorMessage = "unknown error"; |
441 | int tickstart = Util.EnvironmentTickCount(); | 441 | int tickstart = Util.EnvironmentTickCount(); |
442 | int tickdata = 0; | 442 | int tickdata = 0; |
@@ -451,7 +451,7 @@ namespace OpenSim.Framework | |||
451 | request.MaximumAutomaticRedirections = 10; | 451 | request.MaximumAutomaticRedirections = 10; |
452 | request.ReadWriteTimeout = timeout / 4; | 452 | request.ReadWriteTimeout = timeout / 4; |
453 | request.Headers[OSHeaderRequestID] = reqnum.ToString(); | 453 | request.Headers[OSHeaderRequestID] = reqnum.ToString(); |
454 | 454 | ||
455 | if (data != null) | 455 | if (data != null) |
456 | { | 456 | { |
457 | queryString = BuildQueryString(data); | 457 | queryString = BuildQueryString(data); |
@@ -460,7 +460,7 @@ namespace OpenSim.Framework | |||
460 | LogOutgoingDetail("SEND", reqnum, queryString); | 460 | LogOutgoingDetail("SEND", reqnum, queryString); |
461 | 461 | ||
462 | byte[] buffer = System.Text.Encoding.UTF8.GetBytes(queryString); | 462 | byte[] buffer = System.Text.Encoding.UTF8.GetBytes(queryString); |
463 | 463 | ||
464 | request.ContentLength = buffer.Length; | 464 | request.ContentLength = buffer.Length; |
465 | request.ContentType = "application/x-www-form-urlencoded"; | 465 | request.ContentType = "application/x-www-form-urlencoded"; |
466 | using (Stream requestStream = request.GetRequestStream()) | 466 | using (Stream requestStream = request.GetRequestStream()) |
@@ -538,7 +538,7 @@ namespace OpenSim.Framework | |||
538 | } | 538 | } |
539 | 539 | ||
540 | #endregion FormRequest | 540 | #endregion FormRequest |
541 | 541 | ||
542 | #region Uri | 542 | #region Uri |
543 | 543 | ||
544 | /// <summary> | 544 | /// <summary> |
@@ -591,7 +591,7 @@ namespace OpenSim.Framework | |||
591 | } | 591 | } |
592 | 592 | ||
593 | /// <summary> | 593 | /// <summary> |
594 | /// Appends a query string to a Uri that may or may not have existing | 594 | /// Appends a query string to a Uri that may or may not have existing |
595 | /// query parameters | 595 | /// query parameters |
596 | /// </summary> | 596 | /// </summary> |
597 | /// <param name="uri">Uri to append the query to</param> | 597 | /// <param name="uri">Uri to append the query to</param> |
@@ -643,7 +643,7 @@ namespace OpenSim.Framework | |||
643 | } | 643 | } |
644 | 644 | ||
645 | /// <summary> | 645 | /// <summary> |
646 | /// | 646 | /// |
647 | /// </summary> | 647 | /// </summary> |
648 | /// <param name="collection"></param> | 648 | /// <param name="collection"></param> |
649 | /// <param name="key"></param> | 649 | /// <param name="key"></param> |
@@ -662,12 +662,12 @@ namespace OpenSim.Framework | |||
662 | #region Stream | 662 | #region Stream |
663 | 663 | ||
664 | /// <summary> | 664 | /// <summary> |
665 | /// Copies the contents of one stream to another, starting at the | 665 | /// Copies the contents of one stream to another, starting at the |
666 | /// current position of each stream | 666 | /// current position of each stream |
667 | /// </summary> | 667 | /// </summary> |
668 | /// <param name="copyFrom">The stream to copy from, at the position | 668 | /// <param name="copyFrom">The stream to copy from, at the position |
669 | /// where copying should begin</param> | 669 | /// where copying should begin</param> |
670 | /// <param name="copyTo">The stream to copy to, at the position where | 670 | /// <param name="copyTo">The stream to copy to, at the position where |
671 | /// bytes should be written</param> | 671 | /// bytes should be written</param> |
672 | /// <param name="maximumBytesToCopy">The maximum bytes to copy</param> | 672 | /// <param name="maximumBytesToCopy">The maximum bytes to copy</param> |
673 | /// <returns>The total number of bytes copied</returns> | 673 | /// <returns>The total number of bytes copied</returns> |
@@ -811,7 +811,7 @@ namespace OpenSim.Framework | |||
811 | /// </param> | 811 | /// </param> |
812 | /// <param name="maxConnections"></param> | 812 | /// <param name="maxConnections"></param> |
813 | /// <returns> | 813 | /// <returns> |
814 | /// The response. If there was an internal exception or the request timed out, | 814 | /// The response. If there was an internal exception or the request timed out, |
815 | /// then the default(TResponse) is returned. | 815 | /// then the default(TResponse) is returned. |
816 | /// </returns> | 816 | /// </returns> |
817 | public static void MakeRequest<TRequest, TResponse>(string verb, | 817 | public static void MakeRequest<TRequest, TResponse>(string verb, |
@@ -909,7 +909,7 @@ namespace OpenSim.Framework | |||
909 | // If the server returns a 404, this appears to trigger a System.Net.WebException even though that isn't | 909 | // If the server returns a 404, this appears to trigger a System.Net.WebException even though that isn't |
910 | // documented in MSDN | 910 | // documented in MSDN |
911 | using (WebResponse response = request.EndGetResponse(res2)) | 911 | using (WebResponse response = request.EndGetResponse(res2)) |
912 | { | 912 | { |
913 | try | 913 | try |
914 | { | 914 | { |
915 | using (Stream respStream = response.GetResponseStream()) | 915 | using (Stream respStream = response.GetResponseStream()) |
@@ -930,7 +930,7 @@ namespace OpenSim.Framework | |||
930 | if (e.Response is HttpWebResponse) | 930 | if (e.Response is HttpWebResponse) |
931 | { | 931 | { |
932 | using (HttpWebResponse httpResponse = (HttpWebResponse)e.Response) | 932 | using (HttpWebResponse httpResponse = (HttpWebResponse)e.Response) |
933 | { | 933 | { |
934 | if (httpResponse.StatusCode != HttpStatusCode.NotFound) | 934 | if (httpResponse.StatusCode != HttpStatusCode.NotFound) |
935 | { | 935 | { |
936 | // We don't appear to be handling any other status codes, so log these feailures to that | 936 | // We don't appear to be handling any other status codes, so log these feailures to that |
@@ -955,7 +955,7 @@ namespace OpenSim.Framework | |||
955 | "[ASYNC REQUEST]: Request {0} {1} failed with exception {2}{3}", | 955 | "[ASYNC REQUEST]: Request {0} {1} failed with exception {2}{3}", |
956 | verb, requestUrl, e.Message, e.StackTrace); | 956 | verb, requestUrl, e.Message, e.StackTrace); |
957 | } | 957 | } |
958 | 958 | ||
959 | // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); | 959 | // m_log.DebugFormat("[ASYNC REQUEST]: Received {0}", deserial.ToString()); |
960 | 960 | ||
961 | try | 961 | try |
@@ -968,7 +968,7 @@ namespace OpenSim.Framework | |||
968 | "[ASYNC REQUEST]: Request {0} {1} callback failed with exception {2}{3}", | 968 | "[ASYNC REQUEST]: Request {0} {1} callback failed with exception {2}{3}", |
969 | verb, requestUrl, e.Message, e.StackTrace); | 969 | verb, requestUrl, e.Message, e.StackTrace); |
970 | } | 970 | } |
971 | 971 | ||
972 | }, null); | 972 | }, null); |
973 | } | 973 | } |
974 | 974 | ||
@@ -997,7 +997,7 @@ namespace OpenSim.Framework | |||
997 | } | 997 | } |
998 | } | 998 | } |
999 | finally | 999 | finally |
1000 | { | 1000 | { |
1001 | if (buffer != null) | 1001 | if (buffer != null) |
1002 | buffer.Dispose(); | 1002 | buffer.Dispose(); |
1003 | } | 1003 | } |
@@ -1168,7 +1168,7 @@ namespace OpenSim.Framework | |||
1168 | /// Request timeout in milliseconds. Timeout.Infinite indicates no timeout. If 0 is passed then the default HttpWebRequest timeout is used (100 seconds) | 1168 | /// Request timeout in milliseconds. Timeout.Infinite indicates no timeout. If 0 is passed then the default HttpWebRequest timeout is used (100 seconds) |
1169 | /// </param> | 1169 | /// </param> |
1170 | /// <returns> | 1170 | /// <returns> |
1171 | /// The response. If there was an internal exception or the request timed out, | 1171 | /// The response. If there was an internal exception or the request timed out, |
1172 | /// then the default(TResponse) is returned. | 1172 | /// then the default(TResponse) is returned. |
1173 | /// </returns> | 1173 | /// </returns> |
1174 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout) | 1174 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout) |
@@ -1191,7 +1191,7 @@ namespace OpenSim.Framework | |||
1191 | /// </param> | 1191 | /// </param> |
1192 | /// <param name="maxConnections"></param> | 1192 | /// <param name="maxConnections"></param> |
1193 | /// <returns> | 1193 | /// <returns> |
1194 | /// The response. If there was an internal exception or the request timed out, | 1194 | /// The response. If there was an internal exception or the request timed out, |
1195 | /// then the default(TResponse) is returned. | 1195 | /// then the default(TResponse) is returned. |
1196 | /// </returns> | 1196 | /// </returns> |
1197 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections) | 1197 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections) |
@@ -1210,7 +1210,7 @@ namespace OpenSim.Framework | |||
1210 | /// </param> | 1210 | /// </param> |
1211 | /// <param name="maxConnections"></param> | 1211 | /// <param name="maxConnections"></param> |
1212 | /// <returns> | 1212 | /// <returns> |
1213 | /// The response. If there was an internal exception or the request timed out, | 1213 | /// The response. If there was an internal exception or the request timed out, |
1214 | /// then the default(TResponse) is returned. | 1214 | /// then the default(TResponse) is returned. |
1215 | /// </returns> | 1215 | /// </returns> |
1216 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections, IServiceAuth auth) | 1216 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections, IServiceAuth auth) |
@@ -1375,7 +1375,7 @@ namespace OpenSim.Framework | |||
1375 | 1375 | ||
1376 | return deserial; | 1376 | return deserial; |
1377 | } | 1377 | } |
1378 | 1378 | ||
1379 | public static class XMLResponseHelper | 1379 | public static class XMLResponseHelper |
1380 | { | 1380 | { |
1381 | public static TResponse LogAndDeserialize<TRequest, TResponse>(int reqnum, Stream respStream, long contentLength) | 1381 | public static TResponse LogAndDeserialize<TRequest, TResponse>(int reqnum, Stream respStream, long contentLength) |
@@ -1400,7 +1400,7 @@ namespace OpenSim.Framework | |||
1400 | } | 1400 | } |
1401 | } | 1401 | } |
1402 | 1402 | ||
1403 | 1403 | ||
1404 | public static class XMLRPCRequester | 1404 | public static class XMLRPCRequester |
1405 | { | 1405 | { |
1406 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 1406 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
@@ -1444,7 +1444,7 @@ namespace OpenSim.Framework | |||
1444 | { | 1444 | { |
1445 | m_log.Error("Error parsing XML-RPC response", e); | 1445 | m_log.Error("Error parsing XML-RPC response", e); |
1446 | } | 1446 | } |
1447 | 1447 | ||
1448 | if (Resp.IsFault) | 1448 | if (Resp.IsFault) |
1449 | { | 1449 | { |
1450 | m_log.DebugFormat( | 1450 | m_log.DebugFormat( |