private void ContentLengthNumeric(int count) { for (var i = 0; i < count; i++) { _responseHeadersDirect.Reset(); _response.ContentLength = 0; } }
public async Task ExecuteAsync() { try { while (true) { var result = await Input.Reader.ReadAsync(); var inputBuffer = result.Buffer; var consumed = inputBuffer.Start; var examined = inputBuffer.End; try { if (inputBuffer.IsEmpty && result.IsCompleted) { break; } ParseHttpRequest(inputBuffer, out consumed, out examined); if (_state != State.Body && result.IsCompleted) { // Bad request break; } if (_state == State.Body) { var outputBuffer = Output.Writer.Alloc(); if (_method == HttpMethod.Get) { HandleRequest(ref outputBuffer); } else { Default(ref outputBuffer); } await outputBuffer.FlushAsync(); _path = null; ResponseHeaders.Reset(); _state = State.StartLine; } } finally { Input.Reader.Advance(consumed, examined); } } Input.Reader.Complete(); } catch (Exception ex) { Input.Reader.Complete(ex); } finally { Output.Writer.Complete(); } }
public void Uninitialize() { RequestHeaders.Reset(); ResponseHeaders.Reset(); }