public HttpServerSocketDelegate(IHttpServerTransaction transaction, IHttpServerTransactionDelegate transactionDelegate) { this.transaction = transaction; this.transactionDelegate = transactionDelegate; transactionTransform = new ParserToTransactionTransform(transaction, transactionDelegate); parser = new HttpParser(new ParserDelegate(transactionTransform)); }
public void OnRequest(IHttpServerTransaction tx, HttpRequestHead request, bool shouldKeepAlive) { current = new HttpRequest() { Head = request, ShouldKeepAlive = shouldKeepAlive, Data = new DataBuffer() }; }
public static void OnContinue(this IHttpServerTransaction transaction) { // write HTTP/1.1 100 Continue transaction.OnResponse(new HttpResponseHead() { Status = "100 Continue" }); transaction.OnResponseEnd(); }
public void OnEnd(IHttpServerTransaction tx) { if (GotOnEnd) { throw new Exception("OnEnd was called more than once."); } GotOnEnd = true; }
void HandOffTransactionIfPossible() { if (gotResponse && (body == null || (body != null && bodyFinished)) && transaction != null && next != null) { next.AttachTransaction(transaction); transaction = null; next = null; body = null; } }
public bool OnRequestData(IHttpServerTransaction tx, ArraySegment <byte> data, Action continuation) { current.Data.Add(data); if (OnDataAction != null) { return(OnDataAction(data, continuation)); } return(false); }
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); }
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()); }
public void OnRequestEnd(IHttpServerTransaction tx) { Requests.Add(current); }
public void OnRequestEnd(IHttpServerTransaction transaction) { currentContext.RequestBody.OnEnd(); }
public void AttachTransaction(IHttpServerTransaction transaction) { transaction.OnEnd(); }
public TransactionInput(IHttpServerTransaction transaction, IHttpServerTransactionDelegate del) { tx = transaction; this.del = del; }
public void OnClose(IHttpServerTransaction tx) { }
public void OnError(IHttpServerTransaction tx, Exception e) { Exception = e; }
public bool OnRequestData(IHttpServerTransaction transaction, ArraySegment <byte> data, Action continuation) { return(currentContext.RequestBody.OnData(data, continuation)); }
public void OnError(Exception e) { transaction.Dispose(); transaction = null; next = null; }
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(); }