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