IOSHttpResponse.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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;
  29. using System.Collections.Specialized;
  30. using System.IO;
  31. using System.Net;
  32. using System.Text;
  33. using System.Web;
  34. namespace OpenSim.Framework.Servers.HttpServer
  35. {
  36. public interface IOSHttpResponse
  37. {
  38. /// <summary>
  39. /// Content type property.
  40. /// </summary>
  41. /// <remarks>
  42. /// Setting this property will also set IsContentTypeSet to
  43. /// true.
  44. /// </remarks>
  45. string ContentType { get; set; }
  46. /// <summary>
  47. /// Boolean property indicating whether the content type
  48. /// property actively has been set.
  49. /// </summary>
  50. /// <remarks>
  51. /// IsContentTypeSet will go away together with .NET base.
  52. /// </remarks>
  53. // public bool IsContentTypeSet
  54. // {
  55. // get { return _contentTypeSet; }
  56. // }
  57. // private bool _contentTypeSet;
  58. /// <summary>
  59. /// Length of the body content; 0 if there is no body.
  60. /// </summary>
  61. long ContentLength { get; set; }
  62. /// <summary>
  63. /// Alias for ContentLength.
  64. /// </summary>
  65. long ContentLength64 { get; set; }
  66. /// <summary>
  67. /// Encoding of the body content.
  68. /// </summary>
  69. Encoding ContentEncoding { get; set; }
  70. bool KeepAlive { get; set; }
  71. /// <summary>
  72. /// Get or set the keep alive timeout property (default is
  73. /// 20). Setting this to 0 also disables KeepAlive. Setting
  74. /// this to something else but 0 also enable KeepAlive.
  75. /// </summary>
  76. int KeepAliveTimeout { get; set; }
  77. /// <summary>
  78. /// Return the output stream feeding the body.
  79. /// </summary>
  80. /// <remarks>
  81. /// On its way out...
  82. /// </remarks>
  83. Stream OutputStream { get; }
  84. string ProtocolVersion { get; set; }
  85. int Priority { get; set; }
  86. byte[] RawBuffer { get; set; }
  87. int RawBufferStart { get; set; }
  88. int RawBufferLen { get; set; }
  89. /// <summary>
  90. /// Return the output stream feeding the body.
  91. /// </summary>
  92. Stream Body { get; }
  93. /// <summary>
  94. /// Chunk transfers.
  95. /// </summary>
  96. bool SendChunked { get; set; }
  97. /// <summary>
  98. /// HTTP status code.
  99. /// </summary>
  100. int StatusCode { get; set; }
  101. /// <summary>
  102. /// HTTP status description.
  103. /// </summary>
  104. string StatusDescription { get; set; }
  105. double RequestTS { get; }
  106. /// <summary>
  107. /// Set response as a http redirect
  108. /// </summary>
  109. /// <param name="url">redirection target url</param>
  110. /// <param name="redirStatusCode">the response Status, must be Found, Redirect, Moved,MovedPermanently,RedirectKeepVerb, RedirectMethod, TemporaryRedirect. Defaults to Redirect</param>
  111. void Redirect(string url, HttpStatusCode redirStatusCode = HttpStatusCode.Redirect);
  112. /// <summary>
  113. /// Add a header field and content to the response.
  114. /// </summary>
  115. /// <param name="key">string containing the header field
  116. /// name</param>
  117. /// <param name="value">string containing the header field
  118. /// value</param>
  119. void AddHeader(string key, string value);
  120. }
  121. }