HttpsRequestHandler
Request handler for HTTPS GET and POST requests.
Sample configuration file<./p>
Example
use Web.HTTP.Server;
class Test {
function : Main(args : String[]) ~ Nil {
WebServer->ServeSecure("config/simple_config.json");
}
}
class RequestHandler from HttpsRequestHandler {
New() {
Parent();
}
method : ProcessGet(request : Request, response : Response) ~ Bool {
return response->HasStaticHandler();
}
method : ProcessPost(request : Request, response : Response) ~ Bool {
return false;
}
}Operations
- New
- GetHeaders
- IsPersistent
- ProcessDelete
- ProcessGet
- ProcessPatch
- ProcessPost
- ProcessPut
- ProcessResponse
- Run
- ServeOne
- SetConfig
GetHeaders #
Get HTTP headers
method : public : GetHeaders() ~ Map<String,String>Return
| Type | Description |
|---|---|
| Map<String,String> | HTTP headers |
IsPersistent #
Decides whether the connection survives this request. An explicit Connection header wins; otherwise HTTP/1.1 persists by default and HTTP/1.0 does not, per RFC 7230.
method : private : IsPersistent(version:String, headers:Map<String,String>) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| version | String | HTTP version from the request line |
| headers | Map<String,String> | request headers, names already lower-cased |
Return
| Type | Description |
|---|---|
| Bool | true to keep the connection open |
ProcessDelete #
Callback for DELETE requests. Override to handle DELETE.
method : public : ProcessDelete(request:Web.HTTP.Server.Request, response:Web.HTTP.Server.Response) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| request | Request | HTTP request |
| response | Response | HTTP response |
ProcessGet # virtual
Callback for GET requests
method : private : virtual : ProcessGet(request:Web.HTTP.Server.Request, response:Web.HTTP.Server.Response) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| request | Request | HTTP request |
| response | Response | HTTP response |
Return
| Type | Description |
|---|---|
| Bool | true to continue processing, false otherwise |
ProcessPatch #
Callback for PATCH requests. Override to handle PATCH.
method : public : ProcessPatch(request:Web.HTTP.Server.Request, response:Web.HTTP.Server.Response) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| request | Request | HTTP request |
| response | Response | HTTP response |
ProcessPost # virtual
Callback for POST requests
method : private : virtual : ProcessPost(request:Web.HTTP.Server.Request, response:Web.HTTP.Server.Response) ~ BoolParameters
| Name | Type | Description |
|---|---|---|
| request | Request | HTTP request |
| response | Response | HTTP response |
Return
| Type | Description |
|---|---|
| Bool | true to continue processing, false otherwise |
ProcessPut #
Callback for PUT requests. Override to handle PUT.
method : public : ProcessPut(request:Web.HTTP.Server.Request, response:Web.HTTP.Server.Response) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| request | Request | HTTP request |
| response | Response | HTTP response |
ProcessResponse #
Processes the HTTPS response
method : private : ProcessResponse(response:Response, is_head:Bool) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| response | Response | HTTP response |
| is_head | Bool | true if HEAD request, false otherwise |
Run #
Executes the request handler thread
method : public : Run(param:Base) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| param | Base | thread parameter containing client socket |
ServeOne #
Serves a single request on the already-open connection
method : private : ServeOne() ~ BoolParameters
| Name | Type | Description |
|---|---|---|
Return
| Type | Description |
|---|---|
| Bool | true if the connection should stay open for another request |
SetConfig #
Sets the server configuration
method : public : SetConfig(server_config:WebServerConfig, is_debug:Bool) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| server_config | WebServerConfig | web server configuration |
| is_debug | Bool | true for debug output, false otherwise |