Ejemplo n.º 1
0
 public void WriteHead(Outgoing head)
 {
     if (head.Version == null)
     {
         head.Version = CurrentMessage.Item1.HttpVersion;
     }
     HeadSerializer.Write(head);
     if (!BodySerializer.TrySetFor(head))
     {
         throw new ArgumentException("Could not determine body transfer type from the provided head");
     }
 }
Ejemplo n.º 2
0
 public Connection(TcpSocket socket, HeadParser <Incoming> headParser, HeadSerializer <Outgoing> headSerializer,
                   HttpMessageHandler <Incoming, Outgoing> messageHandler)
 {
     Base           = socket;
     HeadParser     = headParser;
     HeadSerializer = headSerializer;
     BodyParser     = new BodyParser();
     BodySerializer = new BodySerializer();
     OnMessage      = messageHandler;
     new Thread(ProcessorThread)
     {
         Name = "HTTP pipeline thread"
     }.Start();
     Base.OnClose += End;
 }
Ejemplo n.º 3
0
 virtual protected void End()
 {
     HeadParser.Unpipe();
     BodyParser.Unpipe();
     if (!Base.ReadableEnded && !Upgrading)
     {
         Base.Unpipe();
     }
     HeadSerializer.Unpipe();
     BodySerializer.Unpipe();
     HeadParser.End();
     HeadSerializer.End();
     BodyParser.End();
     BodySerializer.End();
     OnEnd?.Invoke();
 }