TestOSHttpResponse.cs 4.7 KB

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