2023-10-31 11:47:27 -04:00

50 lines
1.4 KiB
C#
Executable File

//
// HttpRequest.cs
//
// Author:
// beckermj <>
//
// Copyright (c) 2023 ${CopyrightHolder}
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
namespace Mocha.Web.Server.Sys
{
public class HttpRequest : Request
{
public string Method { get; private set; } = null;
public string Path { get; private set; } = null;
public string Protocol { get; private set; } = null;
private HttpRequest()
{
}
public static HttpRequest Parse(string line)
{
string[] httpParms = line.Split(new char[] { ' ' });
if (httpParms.Length >= 3)
{
HttpRequest req = new HttpRequest();
req.Method = httpParms[0];
req.Path = httpParms[1];
req.Protocol = httpParms[2];
return req;
}
throw new NotSupportedException();
}
}
}