/// <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); } }
/// <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 = ""; }
/// <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"; } }