public ISocketDelegate OnConnection(IServer server, ISocket socket) { // XXX freelist var txDel = new HttpServerTransactionDelegate(responseFactory, requestDelegate); var socketDelegate = new HttpServerSocketDelegate(txDel); socketDelegate.Start(socket); return socketDelegate; }
public ISocketDelegate OnConnection(IServer server, ISocket socket) { var txDel = new HttpServerTransactionDelegate(socket.RemoteEndPoint.Address, responseFactory, requestDelegate); var delWrapper = new HttpServerTransactionDelegateWrapper(txDel, connWatcher, socket); var socketDelegate = new IosHttpServerSocketDelegate(delWrapper); socketDelegate.Start(socket); return socketDelegate; }
public ISocketDelegate OnConnection(IServer server, ISocket socket) { // XXX freelist var txDel = new HttpServerTransactionDelegate(socket.RemoteEndPoint.Address, responseFactory, requestDelegate); var socketDelegate = new HttpServerSocketDelegate(txDel); socketDelegate.Start(socket); return(socketDelegate); }
public ISocketDelegate OnConnection(IServer server, ISocket socket) { // XXX freelist var tx = new HttpServerTransaction(socket); var txDel = new HttpServerTransactionDelegate(requestDelegate); var socketDelegate = new HttpServerSocketDelegate(tx, txDel); return(socketDelegate); }
public void Adds_x_forwarded_for_if_none() { var requestHead = default(HttpRequestHead); var txDel = new HttpServerTransactionDelegate(IPAddress.Parse("8.8.8.8"), new MockResponseFactory(), new MockRequestDelegate() { OnRequestAction = (head, body, response) => { requestHead = head; } }); txDel.Subscribe(new MockObserver<IDataProducer>()); txDel.OnRequest(new HttpRequestHead() { Headers = new Dictionary<string, string>() }, false); Assert.That(requestHead.Headers["X-Forwarded-For"], Is.EqualTo("8.8.8.8")); }
public void Append_x_forwarded_for_if_any() { var requestHead = default(HttpRequestHead); var txDel = new HttpServerTransactionDelegate(IPAddress.Parse("8.8.8.8"), new MockResponseFactory(), new MockRequestDelegate() { OnRequestAction = (head, body, response) => { requestHead = head; } }); txDel.Subscribe(new MockObserver<IDataProducer>()); txDel.OnRequest(new HttpRequestHead() { Headers = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase) { { "x-ForWarDED-FOr", "4.4.4.4" } } }, false); Assert.That(requestHead.Headers["x-Forwarded-For"], Is.EqualTo("4.4.4.4,8.8.8.8")); }
public HttpServerTransactionDelegate CreateTransaction() { responseDelegate = new MockResponseDelegate(); var tx = new HttpServerTransactionDelegate( new MockResponseFactory() { OnCreate = (head, shouldKeepAlive, end) => { closeConnectionAction = end; ShouldKeepAlive = shouldKeepAlive; return responseDelegate; } }, new MockRequestDelegate() { OnRequestAction = (head, body, response) => { Assert.That(response, Is.SameAs(responseDelegate)); requestBody = body; if (callbacks.OnRequest != null) callbacks.OnRequest(); } }); messageObserver = new MockObserver<IDataProducer>(); messageObserverDisposable = tx.Subscribe(messageObserver); return tx; }
public void SetUp() { requestCallbacker = new RequestCallbacker(); requestAccumulator = new RequestAccumulator(requestCallbacker); var requestDelegate = new RequestDelegate(requestAccumulator); var transactionDelegate = new HttpServerTransactionDelegate(requestDelegate); responseAccumulator = new ResponseAccumulator(); transactionInput = new TransactionInput(responseAccumulator, transactionDelegate); postedActions = new Queue<Action>(); }
public ISocketDelegate OnConnection(IServer server, ISocket socket) { var txDel = new HttpServerTransactionDelegate(responseFactory); txDel.Subscribe(new OutputSegmentQueue(socket)); return new HttpServerSocketDelegate(txDel); }