private void Plaintext(int count)
        {
            for (var i = 0; i < count; i++)
            {
                _responseHeadersDirect.Reset();

                _response.StatusCode = 200;
                _response.ContentType = "text/plain";
                _response.ContentLength = 13;

                var dateHeaderValues = _dateHeaderValueManager.GetDateHeaderValues();
                _responseHeadersDirect.SetRawDate(dateHeaderValues.String, dateHeaderValues.Bytes);
                _responseHeadersDirect.SetRawServer("Kestrel", _bytesServer);
            }
        }
示例#2
0
 public void Initialize(DateHeaderValueManager dateValueManager)
 {
     ResponseHeaders.SetRawDate(
         dateValueManager.GetDateHeaderValue(),
         dateValueManager.GetDateHeaderValueBytes());
     ResponseHeaders.SetRawServer("Kestrel", BytesServer);
 }
            private void Default(ref WritableBuffer outputBuffer)
            {
                var writer = new WritableBufferWriter(outputBuffer);

                // HTTP 1.1 OK
                writer.Write(_bytesHttpVersion11);
                writer.Write(ReasonPhrases.ToStatusBytes(200, reasonPhrase: null));

                // Headers
                var values = _dateHeaderValueManager.GetDateHeaderValues();

                ResponseHeaders.SetRawDate(values.String, values.Bytes);
                ResponseHeaders.SetRawServer("Custom", _headerServer);
                ResponseHeaders.ContentLength = 0;

                // Write headers
                ResponseHeaders.CopyTo(ref writer);
                writer.Write(_bytesEndHeaders);
            }