#region CPL License
/*
Nuclex Framework
Copyright (C) 2002-2009 Nuclex Development Labs
This library is free software; you can redistribute it and/or
modify it under the terms of the IBM Common Public License as
published by the IBM Corporation; either version 1.0 of the
License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
IBM Common Public License for more details.
You should have received a copy of the IBM Common Public
License along with this library
*/
#endregion
using System;
using System.Collections.Generic;
using Nuclex.Support.Collections;
namespace Nuclex.Networking.Http {
/// Stores the informations about an HTTP request
public class Request {
///
enum UriOption {
/// Request is targeted at the server as a whole
Asterisk,
/// Request contains absolute URI (including the host)
AbsoluteUri,
/// Request only contains the resource path
AbsolutePath,
/// Request only specifies the host
Authority
}
/// Initializes a new HTTP request container
/// Request method being used by the client
/// URI being accessed by the client
/// Version of the HTTP protocol being used
/// Headers with additional options from the client
///
/// Takes ownership of the headers collection. This collection should not be
/// used or modified by the original owner after the constructor has completed.
/// If you need to keep the dictionary, pass a cloned dictionary to
/// this constructor instead.
///
internal Request(
string method, string uri, string version, IDictionary headers
) {
this.method = method;
this.uri = uri;
this.version = version;
this.headers = new ReadOnlyDictionary(headers);
}
/// Method of the request
///
/// Requests can use several "methods" to obtain data from the server. The
/// methods defined by HTTP/1.1 are "OPTIONS", "GET", "HEAD", "POST", "PUT",
/// "DELETE", "TRACE" and "CONNECT"
///
public string Method {
get { return this.method; }
}
/// URI of the resource the client tries to access
public string Uri {
get { return this.uri; }
}
/// Version number of the HTTP protocol used by the client
public string Version {
get { return this.version; }
}
/// Headers provided with the HTTP request by the client
public ReadOnlyDictionary Headers {
get { return this.headers; }
}
/// HTTP request method used by the client
private string method;
/// URI of the resource accessed by the client
private string uri;
/// Version of the HTTP protocol used
private string version;
///
/// Headers providing additional informations about the client's preferences
///
private ReadOnlyDictionary headers;
}
} // namespace Nuclex.Networking.Http