コード例 #1
0
		/// <summary>
		/// Initializes a new instance of the HttpStatusLine class
		/// </summary>
		/// <param name="protocolVersion">The protocol version in use</param>
		/// <param name="status">The status-code and reason-phrase</param>
		public HttpStatusLine(HttpProtocolVersion protocolVersion, HttpStatus status)
		{
			if (protocolVersion == null)
				throw new ArgumentNullException("protocolVersion");

			if (status == null)
				throw new ArgumentNullException("status");

			_protocolVersion = protocolVersion;
			_status = status;
		}
コード例 #2
0
        /// <summary>
        /// Parses a string in the format 'HTTP-Version SP Status-Code SP Reason-Phrase CRLF' into an HttpStatusLine instance
        /// </summary>
        /// <example>
        /// HTTP/1.1 200 OK\r\n
        /// </example>
        /// <param name="value">The string to parse. May contain CRLF.</param>
        /// <returns></returns>
        public static HttpStatusLine Parse(string value)
        {
            int    firstSpace = value.IndexOf(HttpControlChars.SP, 0);
            string a          = value.Substring(0, firstSpace);
            string b          = value.Substring(++firstSpace);

            HttpProtocolVersion protocolVersion = HttpProtocolVersion.Parse(a);
            HttpStatus          status          = HttpStatus.Parse(b);

            return(new HttpStatusLine(protocolVersion, status));
        }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the HttpStatusLine class
        /// </summary>
        /// <param name="protocolVersion">The protocol version in use</param>
        /// <param name="status">The status-code and reason-phrase</param>
        public HttpStatusLine(HttpProtocolVersion protocolVersion, HttpStatus status)
        {
            if (protocolVersion == null)
            {
                throw new ArgumentNullException("protocolVersion");
            }

            if (status == null)
            {
                throw new ArgumentNullException("status");
            }

            _protocolVersion = protocolVersion;
            _status          = status;
        }
コード例 #4
0
		/// <summary>
		/// Initializes a new instance of the HttpStatusLine class
		/// </summary>
		/// <param name="status"></param>
		public HttpStatusLine(HttpStatus status) : this(new HttpProtocolVersion(), status)
		{

		}
コード例 #5
0
		/// <summary>
		/// Initializes a new instance of the HttpStatusLine class
		/// </summary>
		/// <param name="protocolVersion">The protocol version in use</param>
		/// <param name="code">The status-code of the response</param>
		/// <param name="reason">The reason-phrase to describe the status-code</param>
		public HttpStatusLine(HttpProtocolVersion protocolVersion, int code, string reason)
		{
			this.ProtocolVersion = protocolVersion;
			_status = new HttpStatus(code, reason);			
		}
コード例 #6
0
 /// <summary>
 /// Initializes a new instance of the HttpResponse class
 /// </summary>
 /// <param name="status"></param>
 public HttpResponse(HttpStatus status) : base()
 {
     _statusLine = new HttpStatusLine(status);
     this.InitHeaders();
 }
コード例 #7
0
 /// <summary>
 /// Initializes a new instance of the HttpStatusLine class
 /// </summary>
 /// <param name="status"></param>
 public HttpStatusLine(HttpStatus status) : this(new HttpProtocolVersion(), status)
 {
 }
コード例 #8
0
 /// <summary>
 /// Initializes a new instance of the HttpStatusLine class
 /// </summary>
 /// <param name="protocolVersion">The protocol version in use</param>
 /// <param name="code">The status-code of the response</param>
 /// <param name="reason">The reason-phrase to describe the status-code</param>
 public HttpStatusLine(HttpProtocolVersion protocolVersion, int code, string reason)
 {
     this.ProtocolVersion = protocolVersion;
     _status = new HttpStatus(code, reason);
 }
コード例 #9
0
		/// <summary>
		/// Initializes a new instance of the HttpResponse class
		/// </summary>
		/// <param name="status"></param>
		public HttpResponse(HttpStatus status) : base()
		{
			_statusLine = new HttpStatusLine(status);
			this.InitHeaders();
		}