/// <summary> /// Creates a new request. /// </summary> internal FastCGIRequest(int requestId, FastCGIConnection connection, bool keepAlive) { _requestId = requestId; _connection = connection; _keepAlive = keepAlive; _body = new BufferData(); _responseBuffer = new BufferData(); _parameters = new Dictionary <string, string>(); }
/// <summary> /// End this request. /// </summary> public void End() { if (_connection != null) { if (!_responseBuffer.IsEmpty()) { _connection.SendStdout(_requestId, _responseBuffer); _responseBuffer.Clear(); } // Last empty response _connection.SendStdout(_requestId, _responseBuffer); _connection.SendEndRequest(_requestId); _connection.Flush(); if (!_keepAlive) { _connection.Close(); } // Clear connection after closed. _connection = null; } }
private void OnSocketConnected(TcpSocket s) { var conn = new FastCGIConnection(this, s); }