using System;
using System.Collections.Specialized;
using System.IO;
using System.Net;
using OSHttpServer.Exceptions;
namespace OSHttpServer
{
///
/// Contains server side HTTP request information.
///
public interface IHttpRequest
{
///
/// Gets kind of types accepted by the client.
///
string[] AcceptTypes { get; }
uint ID {get; }
///
/// Gets or sets body stream.
///
Stream Body { get; set; }
///
/// Gets or sets kind of connection used for the session.
///
ConnectionType Connection { get; set; }
IHttpClientContext Context { get; }
///
/// Gets or sets number of bytes in the body.
///
int ContentLength { get; set; }
///
/// Gets cookies that was sent with the request.
///
RequestCookies Cookies { get; }
///
/// Gets form parameters.
///
//HttpForm Form { get; }
///
/// Gets headers sent by the client.
///
NameValueCollection Headers { get; }
///
/// Gets or sets version of HTTP protocol that's used.
///
///
/// Probably or .
///
///
string HttpVersion { get; set; }
///
/// Gets whether the request was made by Ajax (Asynchronous JavaScript)
///
bool IsAjax { get; }
///
/// Gets or sets requested method.
///
///
/// Will always be in upper case.
///
///
string Method { get; set; }
/*
///
/// Gets parameter from or .
///
HttpParam Param { get; }
*/
///
/// Gets variables sent in the query string
///
NameValueCollection QueryString { get; }
///
/// Gets or sets requested URI.
///
Uri Uri { get; set; }
///
/// Gets or sets path and query.
///
///
///
/// Are only used during request parsing. Cannot be set after "Host" header have been
/// added.
///
string UriPath { get; set; }
///
/// Called during parsing of a .
///
/// Name of the header, should not be URL encoded
/// Value of the header, should not be URL encoded
/// If a header is incorrect.
void AddHeader(string name, string value);
///
/// Add bytes to the body
///
/// buffer to read bytes from
/// where to start read
/// number of bytes to read
/// Number of bytes actually read (same as length unless we got all body bytes).
/// If body is not writable
/// bytes is null.
/// offset is out of range.
int AddToBody(byte[] bytes, int offset, int length);
///
/// Clear everything in the request
///
void Clear();
///
/// Decode body into a form.
///
/// A list with form decoders.
/// If body contents is not valid for the chosen decoder.
/// If body is still being transferred.
//void DecodeBody(FormDecoderProvider providers);
///
/// Sets the cookies.
///
/// The cookies.
void SetCookies(RequestCookies cookies);
IPEndPoint LocalIPEndPoint { get; }
IPEndPoint RemoteIPEndPoint { get; }
double ArrivalTS { get; set; }
}
}