using System;
using System.Collections.Specialized;
using System.IO;
using System.Net;
using System.Text;
namespace WebDAVSharp.Server.Adapters
{
///
/// This
/// implementation wraps around a
/// instance.
///
internal sealed class HttpListenerRequestAdapter : IHttpListenerRequest
{
#region Private Variables
private readonly HttpListenerRequest _request;
#endregion
#region Public Functions
///
/// Initializes a new instance of the class.
///
/// The to adapt for WebDAV#.
/// request
/// is null.
public HttpListenerRequestAdapter(HttpListenerRequest request)
{
if (request == null)
throw new ArgumentNullException(nameof(request));
_request = request;
}
#endregion
#region Properties
///
/// Gets the internal instance that was adapted for WebDAV#.
///
///
/// The adapted instance.
///
public HttpListenerRequest AdaptedInstance => _request;
///
/// Gets the client IP address and port number from which the request originated.
///
public IPEndPoint RemoteEndPoint => _request.RemoteEndPoint;
///
/// Gets the object requested by the client.
///
public Uri Url => _request.Url;
///
/// Gets the HTTP method specified by the client.
///
public string HttpMethod => _request.HttpMethod;
///
/// Gets the collection of header name/value pairs sent in the request.
///
public NameValueCollection Headers => _request.Headers;
///
/// Gets a that contains the body data sent by the client.
///
public Stream InputStream => _request.InputStream;
///
/// Gets the content that can be used with data sent with the request.
///
public Encoding ContentEncoding => _request.ContentEncoding;
///
/// Gets the length of the body data included in the request.
///
public long ContentLength64 => _request.ContentLength64;
#endregion
}
}