Ejemplo n.º 1
0
 /// <summary>
 /// Writes the collection of HTTP headers to the stream.
 /// </summary>
 /// <param name="headers">The headers.</param>
 public void WriteHeaders(HttpHeaderCollection headers)
 {
     foreach (HttpHeader header in headers)
     {
         WriteHeader(header);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HttpRequest"/> class.
        /// </summary>
        /// <param name="source">The source.</param>
        internal HttpRequest(IHttpTransaction source)
        {
            if (source is HttpClient)
            {
                this.client = (HttpClient)source;
            }
            else
            {
                this.connection = (HttpConnection)source;
            }

            this.headers = new HttpHeaderCollection();
            this.query   = new Dictionary <string, string>();
            this.version = "";
            this.path    = "";
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HttpResponse"/> class.
        /// </summary>
        /// <param name="source">The source.</param>
        internal HttpResponse(IHttpTransaction source)
        {
            if (source is HttpClient)
            {
                this.client = (HttpClient)source;
            }
            else
            {
                this.connection = (HttpConnection)source;
            }

            this.status  = HttpStatus.OK;
            this.buffer  = new MemoryStream();
            this.headers = new HttpHeaderCollection();

            if (source is HttpConnection)
            {
                headers["Content-Type"]    = "text/html";
                headers["X-Frame-Options"] = "deny";
            }
        }