public HttpRequest(IHttpTransaction transaction, HttpHeaders headers, string method, string resource, bool support_1_1) { Transaction = transaction; Headers = headers; Method = method; ResourceUri = resource; Http_1_1_Supported = support_1_1; SetEncoding (); SetPathAndQuery (); }
public HttpResponse(IHttpTransaction transaction, Encoding encoding) { Transaction = transaction; Encoding = encoding; StatusCode = 200; WriteHeaders = true; WriteStatusLine = true; Headers = new HttpHeaders (); SetStandardHeaders (); }
public HttpResponse(IHttpTransaction transaction, Encoding encoding) { Transaction = transaction; Encoding = encoding; StatusCode = 200; WriteHeaders = true; WriteStatusLine = true; Headers = new HttpHeaders (); Stream = new HttpResponseStream (); Cookies = new Dictionary<string, HttpCookie> (); SetStandardHeaders (); }
public HttpRequest(IHttpTransaction transaction, HttpHeaders headers, string method, string resource, bool support_1_1) { Transaction = transaction; Headers = headers; Method = method; ResourceUri = resource; Http_1_1_Supported = support_1_1; Data = new DataDictionary (); UriData = new DataDictionary (); QueryData = new DataDictionary (); PostData = new DataDictionary (); Data.Children.Add (UriData); Data.Children.Add (QueryData); Data.Children.Add (PostData); SetEncoding (); SetPathAndQuery (); }
private void OnHeaders(IOStream stream, byte [] data) { string h = Encoding.ASCII.GetString (data); StringReader reader = new StringReader (h); string verb; string path; string version; string line = reader.ReadLine (); ParseStartLine (line, out verb, out path, out version); HttpHeaders headers = new HttpHeaders (); headers.Parse (reader); Request = new HttpRequest (this, headers, verb, path, Version_1_1_Supported (version)); Response = new HttpResponse (this, Encoding.ASCII); if (headers.ContentLength != null && headers.ContentLength > 0) { stream.ReadBytes ((int) headers.ContentLength, OnBody); return; } Server.IOLoop.QueueTransaction (this); }
private void OnHeaders(IOStream stream, byte [] data) { string h = Encoding.ASCII.GetString (data); StringReader reader = new StringReader (h); string verb; string path; string version; string line = reader.ReadLine (); ParseStartLine (line, out verb, out path, out version); HttpHeaders headers = new HttpHeaders (); headers.Parse (reader); Request = new HttpRequest (this, headers, verb, path, Version_1_1_Supported (version)); Response = new HttpResponse (this, Encoding.ASCII); if (headers.ContentLength != null && headers.ContentLength > 0) { long cl = (long) headers.ContentLength; if (cl < MAX_BUFFERED_CONTENT_LENGTH) { HandleBody (); return; } else { HandleLargeBody (); return; } } stream.DisableReading (); Server.RunTransaction (this); }