Beispiel #1
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 = "";
        }
Beispiel #2
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";
            }
        }