Exemplo n.º 1
0
 internal HttpListenerResponse (HttpListenerContext context)
 {
   _context = context;
   _headers = new WebHeaderCollection ();
   _keepAlive = true;
   _statusCode = 200;
   _statusDescription = "OK";
   _version = HttpVersion.Version11;
 }
Exemplo n.º 2
0
 internal HttpListenerRequest (HttpListenerContext context)
 {
   _context = context;
   _contentLength = -1;
   _headers = new WebHeaderCollection ();
   _identifier = Guid.NewGuid ();
 }
Exemplo n.º 3
0
    internal static HttpRequest Parse (string[] headerParts)
    {
      var requestLine = headerParts[0].Split (new[] { ' ' }, 3);
      if (requestLine.Length != 3)
        throw new ArgumentException ("Invalid request line: " + headerParts[0]);

      var headers = new WebHeaderCollection ();
      for (int i = 1; i < headerParts.Length; i++)
        headers.InternalSet (headerParts[i], false);

      return new HttpRequest (
        requestLine[0], requestLine[1], new Version (requestLine[2].Substring (5)), headers);
    }
Exemplo n.º 4
0
    internal static HttpResponse Parse (string[] headerParts)
    {
      var statusLine = headerParts[0].Split (new[] { ' ' }, 3);
      if (statusLine.Length != 3)
        throw new ArgumentException ("Invalid status line: " + headerParts[0]);

      var headers = new WebHeaderCollection ();
      for (int i = 1; i < headerParts.Length; i++)
        headers.InternalSet (headerParts[i], true);

      return new HttpResponse (
        statusLine[1], statusLine[2], new Version (statusLine[0].Substring (5)), headers);
    }