WriteHeaders() public method

public WriteHeaders ( int statusCode, String extraHeaders ) : void
statusCode int
extraHeaders String
return void
Ejemplo n.º 1
0
        public override void FlushResponse(bool finalFlush) {
            if (_responseStatus == 404 && !_headersSent && finalFlush && _verb == "GET") {
                // attempt directory listing
                if (ProcessDirectoryListingRequest()) {
                    return;
                }
            }

            _connectionPermission.Assert();

            if (!_headersSent) {
                _connection.WriteHeaders(_responseStatus, _responseHeadersBuilder.ToString());
                _headersSent = true;
            }

            for (int i = 0; i < _responseBodyBytes.Count; i++) {
                byte[] bytes = _responseBodyBytes[i];
                _connection.WriteBody(bytes, 0, bytes.Length);
            }

            _responseBodyBytes = new List<byte[]>();

            if (finalFlush) {
                _connection.Close();
            }
        }
Ejemplo n.º 2
0
        public override void FlushResponse(bool finalFlush)
        {
            if (!_headersSent)
            {
                _conn.WriteHeaders(_responseStatus, _responseHeadersBuilder.ToString());
                _headersSent = true;
            }

            for (int i = 0; i < _responseBodyBytes.Count; i++)
            {
                byte[] bytes = (byte[])_responseBodyBytes[i];
                _conn.WriteBody(bytes, 0, bytes.Length);
            }

            _responseBodyBytes = new ArrayList();

            if (finalFlush)
            {
                _conn.Close();
            }
        }