/// <inheritdoc /> public void ProcessRequest() { using (var io = new TcpIoWrapper(TcpClient)) { try { _outputStream = io.StreamWriter; ParseRequest(); ReadHeaders(); HandleRequest(io); } catch (FileNotFoundException) { WriteFailure(HttpStatusCode.NotFound, Statuses.NOTFOUND); } catch (Exception ex) { WriteFailure(HttpStatusCode.InternalServerError, $"{Statuses.INTERNALERROR}: {ex.Message}"); LogAction("Unable to process request: " + ex.Message); } finally { _outputStream = null; } } }
/// <summary> /// Handles the request, given an IO wrapper /// </summary> /// <param name="io"></param> public void HandleRequest(TcpIoWrapper io) { if (Method.Equals(Methods.GET)) { HandleGETRequest(); return; } if (Method.Equals(Methods.POST)) { HandlePOSTRequest(io.RawStream); } }