Represents a HTTP request from a client to the nymea WebServer. More...
Header: | #include <HttpRequest> |
enum | RequestMethod { Get, Post, Put, Delete, Options, Unhandled } |
HttpRequest() | |
HttpRequest(int rawData) | |
void | appendData(const int &data) |
bool | hasPayload() const |
int | httpVersion() const |
bool | isComplete() const |
bool | isValid() const |
nymeaserver::HttpRequest::RequestMethod | method() const |
int | methodString() const |
int | payload() const |
int | rawHeader() const |
int | rawHeaderList() const |
int | url() const |
int | urlQuery() const |
Represents a HTTP request from a client to the nymea WebServer.
This class holds the header and the payload data of a network request from a client to the WebServer.
Note: RFC 7231 HTTP/1.1 Semantics and Content -> http://tools.ietf.org/html/rfc7231
This enum type describes the method of a HttpRequest. Following methods are allowed/handled:
Constant | Value | Description |
---|---|---|
nymeaserver::HttpRequest::Get | 0 | Represents the HTTP/1.1 GET method. |
nymeaserver::HttpRequest::Post | 1 | Represents the HTTP/1.1 POST method. |
nymeaserver::HttpRequest::Put | 2 | Represents the HTTP/1.1 PUT method. |
nymeaserver::HttpRequest::Delete | 3 | Represents the HTTP/1.1 DELETE method. |
nymeaserver::HttpRequest::Options | 4 | Represents the HTTP/1.1 OPTIONS method. |
nymeaserver::HttpRequest::Unhandled | 5 | Represents every other method which is not handled. |
Construct an empty HttpRequest.
Construct a HttpRequest with the given rawData. The rawData will be parsed in this constructor. You can check if the data is valid with isValid(). You can check if the request is complete with isComplete.
See also isValid() and isComplete().
Appends the given data to the current raw data of this HttpRequest. * This method will be used if a HttpRequest is not complete yet. * *
See also isComplete().
Returns true if this HttpRequest has a payload.
Returns the HTTP version of this HttpRequest.
Returns true if this HttpRequest is complete. A HTTP request is complete if "Content-Length" header value matches the actual payload size. Bigger packages will be sent in multiple TCP packages.
Returns true if this HttpRequest is valid. A HTTP request is valid if the header and the payload were paresed successfully without errors.
Returns the RequestMethod of this request.
See also RequestMethod.
Returns the method as human readable string.
Returns the payload (content) of this HttpRequest.
Returns the raw header of this request.
Returns the list of raw header as key and value pairs.
Returns the URL of this HttpRequest.
Returns the URL query of this HttpRequest.