-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from Hieromon/enhance/v156
Enhance/v156
- Loading branch information
Showing
6 changed files
with
20 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name=PageBuilder | ||
version=1.5.5 | ||
version=1.5.6 | ||
author=Hieromon Ikasamo <[email protected]> | ||
maintainer=Hieromon Ikasamo <[email protected]> | ||
sentence=HTML string assembly aid library for ESP8266/ESP32 WebServer. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,8 @@ | |
* PageElement. | ||
* @file PageBuilder.cpp | ||
* @author [email protected] | ||
* @version 1.5.5 | ||
* @date 2023-01-05 | ||
* @version 1.5.6 | ||
* @date 2023-01-30 | ||
* @copyright MIT license. | ||
*/ | ||
|
||
|
@@ -505,14 +505,6 @@ bool PageBuilder::canUpload(PageBuilderUtil::URI_TYPE_SIGNATURE uri) { | |
return true; | ||
} | ||
|
||
/** | ||
* Clear the registered PageElements. | ||
*/ | ||
void PageBuilder::clearElements(void) { | ||
_elements.clear(); | ||
PageElementVT().swap(_elements); | ||
} | ||
|
||
/** | ||
* Calculates the approximate content size, | ||
* not including token replacement. | ||
|
@@ -670,6 +662,7 @@ void PageBuilder::_handle(int code, WebServer& server) { | |
server.sendContent_P(contentBlock.c_str()); | ||
(void)(blkSize); | ||
PB_DBG("blk:%u\n", blkSize); | ||
server.client().flush(); | ||
} | ||
} | ||
else { | ||
|
@@ -703,6 +696,7 @@ void PageBuilder::_handle(int code, WebServer& server) { | |
bp = cBuffer; | ||
cBufferLen = PAGEBUILDER_CONTENTBLOCK_SIZE; | ||
} | ||
server.client().flush(); | ||
blkSize = pe.build(bp, cBufferLen, args); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
* Declaration of PageBuilder class and accompanying PageElement, PageArgument class. | ||
* @file PageBuilder.h | ||
* @author [email protected] | ||
* @version 1.5.4 | ||
* @date 2022-12-01 | ||
* @version 1.5.6 | ||
* @date 2023-01-30 | ||
* @copyright MIT license. | ||
*/ | ||
|
||
|
@@ -111,6 +111,12 @@ using WebServer = ESP8266WebServer; | |
// with chunks. | ||
#ifndef PAGEBUILDER_CONTENTBLOCK_SIZE | ||
#define PAGEBUILDER_CONTENTBLOCK_SIZE 1270 | ||
#if defined(ARDUINO_ESP8266_MAJOR) && defined(ARDUINO_ESP8266_MINOR) && defined(ARDUINO_ESP8266_REVISION) | ||
#if ARDUINO_ESP8266_MAJOR >= 3 && ARDUINO_ESP8266_MINOR >= 1 && ARDUINO_ESP8266_REVISION >= 0 | ||
#undef PAGEBUILDER_CONTENTBLOCK_SIZE | ||
#define PAGEBUILDER_CONTENTBLOCK_SIZE 510 | ||
#endif | ||
#endif | ||
#endif | ||
|
||
// Delimiter character to appear the token in the page element | ||
|
@@ -331,7 +337,7 @@ class PageBuilder : public RequestHandler { | |
void cancel(const bool cancelation = true) { _cancel = cancelation; } | ||
virtual bool canHandle(HTTPMethod requestMethod, PageBuilderUtil::URI_TYPE_SIGNATURE requestUri) override; | ||
virtual bool canUpload(PageBuilderUtil::URI_TYPE_SIGNATURE uri) override; | ||
void clearElements(void); | ||
void clearElements(void) { _elements.clear(); } | ||
void enableCORS(const bool CORS) { _cors = CORS; } | ||
void exitCanHandle(PrepareFuncT prepareFunc) { _canHandle = prepareFunc; } | ||
bool handle(WebServer& server, HTTPMethod requestMethod, PageBuilderUtil::URI_TYPE_SIGNATURE requestUri) override; | ||
|