Exemplo n.º 1
0
        public void OnRequest(RequestInfo request)
        {
            // XXX determine based on request info
            var shouldKeepAlive = ShouldKeepAlive(request.Head);

            del.OnRequest(tx, request.Head, shouldKeepAlive);
        }
Exemplo n.º 2
0
 public void OnRequest(HttpRequestHead request, bool shouldKeepAlive)
 {
     _realDelegate.OnRequest(request, shouldKeepAlive);
     if (request.Uri.StartsWith("/reverse"))
     {
         _isTwoWay = true;
         if (_connectionWatcher != null)
         {
             _connectionWatcher.TwoWaySocketAvailable(_socket);
         }
     }
 }
        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);
        }