public bool Commit(Action continuation)
        {
            while (queue.HasEvents)
            {
                var e = queue.Dequeue();

                switch (e.Type)
                {
                case ParserEventType.RequestHeaders:
                    transactionDelegate.OnRequest(new HttpRequestHead()
                    {
                        Method      = e.Request.Method,
                        Uri         = e.Request.Uri,
                        Path        = e.Request.Path,
                        Fragment    = e.Request.Fragment,
                        QueryString = e.Request.QueryString,
                        Version     = e.Request.Version,
                        Headers     = e.Request.Headers
                    }, e.KeepAlive);
                    break;

                case ParserEventType.RequestBody:
                    if (!queue.HasEvents)
                    {
                        return(transactionDelegate.OnRequestData(e.Data, continuation));
                    }

                    transactionDelegate.OnRequestData(e.Data, null);
                    break;

                case ParserEventType.RequestEnded:
                    transactionDelegate.OnRequestEnd();
                    break;
                }
            }
            return(false);
        }
Exemplo n.º 2
0
 public bool OnRequestData(ArraySegment <byte> data, Action continuation)
 {
     return(_realDelegate.OnRequestData(data, continuation));
 }
Exemplo n.º 3
0
 public void OnRequestData(string data)
 {
     del.OnRequestData(tx, new ArraySegment <byte>(Encoding.ASCII.GetBytes(data)), null);
 }