httpd/http.d

42 lines
547 B
D

module http;
import std.exception;
enum HTTPMethod
{
GET,
HEAD,
POST,
PUT,
DELETE,
CONNECT,
OPTIONS,
TRACE,
invalid
}
struct HTTPRequest
{
HTTPMethod method;
string resource;
string[string] parameters;
string[string] headers;
string httpVersion = "HTTP/1.1";
alias path = resource;
}
struct HTTPResponse
{
string status;
string[string] headers;
string responseBody;
string httpVersion = "HTTP/1.1";
}
class HTTPException : Exception
{
mixin basicExceptionCtors;
}
alias HTTPModule = HTTPResponse function (HTTPRequest);