1
0

IHttpRequests.cs 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using System.Collections.Generic;
  29. using OpenMetaverse;
  30. namespace OpenSim.Region.Framework.Interfaces
  31. {
  32. public enum HttpRequestConstants
  33. {
  34. HTTP_METHOD = 0,
  35. HTTP_MIMETYPE = 1,
  36. HTTP_BODY_MAXLENGTH = 2,
  37. HTTP_VERIFY_CERT = 3,
  38. HTTP_VERBOSE_THROTTLE = 4,
  39. HTTP_CUSTOM_HEADER = 5,
  40. HTTP_PRAGMA_NO_CACHE = 6
  41. }
  42. /// <summary>
  43. /// The initial status of the request before it is placed on the wire.
  44. /// </summary>
  45. /// <remarks>
  46. /// The request may still fail later on, in which case the normal HTTP status is set.
  47. /// </remarks>
  48. [Flags]
  49. public enum HttpInitialRequestStatus
  50. {
  51. OK = 1,
  52. DISALLOWED_BY_FILTER = 2
  53. }
  54. public interface IHttpRequestModule
  55. {
  56. UUID MakeHttpRequest(string url, string parameters, string body);
  57. /// <summary>
  58. /// Starts the http request.
  59. /// </summary>
  60. /// <remarks>
  61. /// This is carried out asynchronously unless it fails initial checks. Results are fetched by the script engine
  62. /// HTTP requests module to be distributed back to scripts via a script event.
  63. /// </remarks>
  64. /// <returns>The ID of the request. If the requested could not be performed then this is UUID.Zero</returns>
  65. /// <param name="localID">Local ID of the object containing the script making the request.</param>
  66. /// <param name="itemID">Item ID of the script making the request.</param>
  67. /// <param name="url">Url to request.</param>
  68. /// <param name="parameters">LSL parameters for the request.</param>
  69. /// <param name="headers">Extra headers for the request.</param>
  70. /// <param name="body">Body of the request.</param>
  71. /// </param>
  72. UUID StartHttpRequest(uint localID, UUID itemID, string url, List<string> parameters, Dictionary<string, string> headers, string body);
  73. /// <summary>
  74. /// Stop and remove all http requests for the given script.
  75. /// </summary>
  76. /// <param name='id'></param>
  77. void StopHttpRequest(uint m_localID, UUID m_itemID);
  78. IServiceRequest GetNextCompletedRequest();
  79. void RemoveCompletedRequest(UUID id);
  80. bool CheckThrottle(uint localID, UUID onerID);
  81. bool CheckAllowed(Uri url);
  82. }
  83. }