1 /** 
2  * Contains HTTP request components.
3  */
4 module handy_httpd.request;
5 
6 import std.socket : Socket;
7 import handy_httpd.server: HttpServer;
8 import handy_httpd.response : HttpResponse;
9 
10 /** 
11  * The data which the server provides to HttpRequestHandlers so that they can
12  * formulate a response.
13  */
14 struct HttpRequest {
15     /** 
16      * The HTTP method verb, such as GET, POST, PUT, etc.
17      */
18     public const string method;
19 
20     /** 
21      * The url of the request, excluding query parameters.
22      */
23     public const string url;
24 
25     /** 
26      * The request version.
27      */
28     public const int ver;
29 
30     /** 
31      * An associative array containing all request headers.
32      */
33     public const string[string] headers;
34 
35     /** 
36      * An associative array containing all request params, if any were given.
37      */
38     public const string[string] params;
39 
40     /** 
41      * An associative array containing any path parameters obtained from the
42      * request url. These are only populated in cases where it is possible to
43      * parse path parameters, such as with a PathDelegatingHandler.
44      */
45     public string[string] pathParams;
46 
47     /** 
48      * A reference to the HttpServer that is handling this request.
49      */
50     public HttpServer server;
51 
52     /** 
53      * The underlying socket that the request was received from, and to which
54      * the response will be written.
55      */
56     public Socket clientSocket;
57 }