public HttpServerSocketDelegate(IHttpServerTransaction transaction, IHttpServerTransactionDelegate transactionDelegate)
 {
     this.transaction = transaction;
     this.transactionDelegate = transactionDelegate;
     transactionTransform = new ParserToTransactionTransform(transaction, transactionDelegate);
     parser = new HttpParser(new ParserDelegate(transactionTransform));
 }
Пример #2
0
 public void OnRequest(IHttpServerTransaction tx, HttpRequestHead request, bool shouldKeepAlive)
 {
     current = new HttpRequest()
     {
         Head = request, ShouldKeepAlive = shouldKeepAlive, Data = new DataBuffer()
     };
 }
Пример #3
0
 public HttpServerSocketDelegate(IHttpServerTransaction transaction, IHttpServerTransactionDelegate transactionDelegate)
 {
     this.transaction         = transaction;
     this.transactionDelegate = transactionDelegate;
     transactionTransform     = new ParserToTransactionTransform(transaction, transactionDelegate);
     parser = new HttpParser(new ParserDelegate(transactionTransform));
 }
Пример #4
0
 public static void OnContinue(this IHttpServerTransaction transaction)
 {
     // write HTTP/1.1 100 Continue
     transaction.OnResponse(new HttpResponseHead()
     {
         Status = "100 Continue"
     });
     transaction.OnResponseEnd();
 }
Пример #5
0
        public void OnEnd(IHttpServerTransaction tx)
        {
            if (GotOnEnd)
            {
                throw new Exception("OnEnd was called more than once.");
            }

            GotOnEnd = true;
        }
Пример #6
0
 void HandOffTransactionIfPossible()
 {
     if (gotResponse && (body == null || (body != null && bodyFinished)) && transaction != null && next != null)
     {
         next.AttachTransaction(transaction);
         transaction = null;
         next        = null;
         body        = null;
     }
 }
Пример #7
0
        public bool OnRequestData(IHttpServerTransaction tx, ArraySegment <byte> data, Action continuation)
        {
            current.Data.Add(data);

            if (OnDataAction != null)
            {
                return(OnDataAction(data, continuation));
            }

            return(false);
        }
Пример #8
0
        public void AttachTransaction(IHttpServerTransaction transaction)
        {
            this.transaction = transaction;

            if (gotContinue)
            {
                transaction.OnContinue();
            }

            if (gotResponse)
            {
                DoWriteResponse();
            }
        }
        public void OnRequest(IHttpServerTransaction transaction, HttpRequestHead request, bool shouldKeepAlive)
        {
            AddXFF(request, transaction.RemoteEndPoint);

            var expectContinue = request.IsContinueExpected();
            var ignoreResponseBody = request.Method != null && request.Method.ToUpperInvariant() == "HEAD";

            currentContext = new TransactionContext(expectContinue, ignoreResponseBody, shouldKeepAlive);

            if (lastSegment == null)
                currentContext.Segment.AttachTransaction(transaction);

            QueueSegment(currentContext.Segment);
            requestDelegate.OnRequest(request, currentContext.RequestBody, currentContext);
        }
Пример #10
0
        public void OnRequest(IHttpServerTransaction transaction, HttpRequestHead request, bool shouldKeepAlive)
        {
            AddXFF(request, transaction.RemoteEndPoint);

            var expectContinue     = request.IsContinueExpected();
            var ignoreResponseBody = request.Method != null && request.Method.ToUpperInvariant() == "HEAD";

            currentContext = new TransactionContext(expectContinue, ignoreResponseBody, shouldKeepAlive);

            if (lastSegment == null)
            {
                currentContext.Segment.AttachTransaction(transaction);
            }

            QueueSegment(currentContext.Segment);
            requestDelegate.OnRequest(request, currentContext.RequestBody, currentContext);
        }
 public bool OnRequestData(IHttpServerTransaction transaction, ArraySegment<byte> data, Action continuation)
 {
     return currentContext.RequestBody.OnData(data, continuation);
 }
 public void OnError(IHttpServerTransaction transaction, Exception e)
 {
     currentContext.RequestBody.OnError(e);
 }
 public void OnEnd(IHttpServerTransaction transaction)
 {
     QueueSegment(new EndSegment());
 }
Пример #14
0
 public void OnRequestEnd(IHttpServerTransaction tx)
 {
     Requests.Add(current);
 }
Пример #15
0
 public void OnRequestEnd(IHttpServerTransaction transaction)
 {
     currentContext.RequestBody.OnEnd();
 }
Пример #16
0
 public void AttachTransaction(IHttpServerTransaction transaction)
 {
     transaction.OnEnd();
 }
Пример #17
0
 public TransactionInput(IHttpServerTransaction transaction, IHttpServerTransactionDelegate del)
 {
     tx       = transaction;
     this.del = del;
 }
Пример #18
0
 public void OnClose(IHttpServerTransaction tx)
 {
 }
 public void OnRequestEnd(IHttpServerTransaction transaction)
 {
     currentContext.RequestBody.OnEnd();
 }
Пример #20
0
 public void OnEnd(IHttpServerTransaction transaction)
 {
     QueueSegment(new EndSegment());
 }
Пример #21
0
 public void OnError(IHttpServerTransaction tx, Exception e)
 {
     Exception = e;
 }
Пример #22
0
 public bool OnRequestData(IHttpServerTransaction transaction, ArraySegment <byte> data, Action continuation)
 {
     return(currentContext.RequestBody.OnData(data, continuation));
 }
Пример #23
0
 public void OnError(Exception e)
 {
     transaction.Dispose();
     transaction = null;
     next        = null;
 }
Пример #24
0
 public void OnError(IHttpServerTransaction transaction, Exception e)
 {
     currentContext.RequestBody.OnError(e);
 }
Пример #25
0
 public TransactionInput(IHttpServerTransaction transaction, IHttpServerTransactionDelegate del)
 {
     tx = transaction;
     this.del = del;
 }
Пример #26
0
 public void OnClose(IHttpServerTransaction transaction)
 {
     transaction.Dispose();
     // XXX return self to freelist
 }
 public ParserToTransactionTransform(IHttpServerTransaction transaction, IHttpServerTransactionDelegate transactionDelegate)
 {
     this.transaction = transaction;
     this.transactionDelegate = transactionDelegate;
     queue = new ParserEventQueue();
 }
 public void OnClose(IHttpServerTransaction transaction)
 {
     transaction.Dispose();
     // XXX return self to freelist
 }
Пример #29
0
 public ParserToTransactionTransform(IHttpServerTransaction transaction, IHttpServerTransactionDelegate transactionDelegate)
 {
     this.transaction         = transaction;
     this.transactionDelegate = transactionDelegate;
     queue = new ParserEventQueue();
 }