Пример #1
0
 public HttpResponse SendRequest(HttpRequest request)
 {
     if (Connection != null)
     {
         Connection.WriteMessage(request);
         return(Connection.ReadMessage() as HttpResponse);
     }
     else
     {
         var writer = new HttpWriter(RawStream);
         writer.WriteMessage(request);
         var parser = new HttpParser(RawStream);
         return(parser.ParseMessageAsync().Result as HttpResponse);
     }
 }
Пример #2
0
        public static async Task <HttpMessage> ParseMessage(HttpConnectionStream connection)
        {
            var parser = new HttpParser(connection);

            return(await parser.ParseMessageAsync());
        }