| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d68a92d commit 6fe85d1
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | name=ESP32 HTTP(S) Webserver | |
| 2 | - version=0.1.0 | ||
| 2 | + version=0.1.1 | ||
| 3 | 3 | author=Frank Hessel <frank@fhessel.de> | |
| 4 | 4 | maintainer=Frank Hessel <frank@fhessel.de> | |
| 5 | 5 | sentence=SSL/TLS-enabled HTTPS server library for the ESP32. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -428,7 +428,7 @@ void HTTPConnection::loop() { | |||
| 428 | 428 | } | |
| 429 | 429 | ||
| 430 | 430 | // Create request context | |
| 431 | - HTTPRequest req = HTTPRequest(this, _httpHeaders, resolvedResource.getParams(), _httpResource, _httpMethod); | ||
| 431 | + HTTPRequest req = HTTPRequest(this, _httpHeaders, resolvedResource.getParams(), _httpResource, _httpMethod, resolvedResource.getMatchingNode()->_tag); | ||
| 432 | 432 | HTTPResponse res = HTTPResponse(this); | |
| 433 | 433 | ||
| 434 | 434 | // Add default headers to the response | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,12 +2,13 @@ | |||
| 2 | 2 | ||
| 3 | 3 | namespace httpsserver { | |
| 4 | 4 | ||
| 5 | - HTTPRequest::HTTPRequest(ConnectionContext * con, HTTPHeaders * headers, ResourceParameters * params, std::string requestString, std::string method): | ||
| 5 | + HTTPRequest::HTTPRequest(ConnectionContext * con, HTTPHeaders * headers, ResourceParameters * params, std::string requestString, std::string method, std::string tag): | ||
| 6 | 6 | _con(con), | |
| 7 | 7 | _headers(headers), | |
| 8 | 8 | _params(params), | |
| 9 | 9 | _requestString(requestString), | |
| 10 | - _method(method) { | ||
| 10 | + _method(method), | ||
| 11 | + _tag(tag) { | ||
| 11 | 12 | ||
| 12 | 13 | HTTPHeader * contentLength = headers->get("Content-Length"); | |
| 13 | 14 | if (contentLength == NULL) { | |
@@ -74,6 +75,10 @@ std::string HTTPRequest::getMethod() { | |||
| 74 | 75 | return _method; | |
| 75 | 76 | } | |
| 76 | 77 | ||
| 78 | + std::string HTTPRequest::getTag() { | ||
| 79 | + return _tag; | ||
| 80 | + } | ||
| 81 | + | ||
| 77 | 82 | bool HTTPRequest::requestComplete() { | |
| 78 | 83 | if (_contentLengthSet) { | |
| 79 | 84 | // If we have a content size, rely on it. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,13 +16,14 @@ namespace httpsserver { | |||
| 16 | 16 | ||
| 17 | 17 | class HTTPRequest { | |
| 18 | 18 | public: | |
| 19 | - HTTPRequest(ConnectionContext * con, HTTPHeaders * headers, ResourceParameters * resource, std::string requestString, std::string method); | ||
| 19 | + HTTPRequest(ConnectionContext * con, HTTPHeaders * headers, ResourceParameters * resource, std::string requestString, std::string method, std::string tag); | ||
| 20 | 20 | virtual ~HTTPRequest(); | |
| 21 | 21 | ||
| 22 | 22 | std::string getHeader(std::string name); | |
| 23 | 23 | void setHeader(std::string name, std::string value); | |
| 24 | 24 | std::string getRequestString(); | |
| 25 | 25 | std::string getMethod(); | |
| 26 | + std::string getTag(); | ||
| 26 | 27 | ||
| 27 | 28 | size_t readChars(char * buffer, size_t length); | |
| 28 | 29 | size_t readBytes(byte * buffer, size_t length); | |
@@ -44,6 +45,7 @@ class HTTPRequest { | |||
| 44 | 45 | ||
| 45 | 46 | std::string _requestString; | |
| 46 | 47 | std::string _method; | |
| 48 | + std::string _tag; | ||
| 47 | 49 | ||
| 48 | 50 | bool _contentLengthSet; | |
| 49 | 51 | size_t _remainingContent; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,10 +2,11 @@ | |||
| 2 | 2 | ||
| 3 | 3 | namespace httpsserver { | |
| 4 | 4 | ||
| 5 | - ResourceNode::ResourceNode(const std::string path, const std::string method, const HTTPSCallbackFunction * callback): | ||
| 5 | + ResourceNode::ResourceNode(const std::string path, const std::string method, const HTTPSCallbackFunction * callback, const std::string tag): | ||
| 6 | 6 | _path(std::move(path)), | |
| 7 | 7 | _method(std::move(method)), | |
| 8 | - _callback(callback) { | ||
| 8 | + _callback(callback), | ||
| 9 | + _tag(tag) { | ||
| 9 | 10 | ||
| 10 | 11 | // Count the parameters | |
| 11 | 12 | _urlParamCount = 0; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,11 +9,12 @@ namespace httpsserver { | |||
| 9 | 9 | ||
| 10 | 10 | class ResourceNode { | |
| 11 | 11 | public: | |
| 12 | - ResourceNode(const std::string path, const std::string method, const HTTPSCallbackFunction * callback); | ||
| 12 | + ResourceNode(const std::string path, const std::string method, const HTTPSCallbackFunction * callback, const std::string tag = ""); | ||
| 13 | 13 | virtual ~ResourceNode(); | |
| 14 | 14 | ||
| 15 | 15 | const std::string _path; | |
| 16 | 16 | const std::string _method; | |
| 17 | + const std::string _tag; | ||
| 17 | 18 | const HTTPSCallbackFunction * _callback; | |
| 18 | 19 | ||
| 19 | 20 | bool hasUrlParameter(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments