From 9dc282fca8636d712a8338809be7f2ad15f9a12c Mon Sep 17 00:00:00 2001 From: Hieromon Ikasamo Date: Wed, 27 Mar 2019 23:25:18 +0900 Subject: [PATCH] Changed the chunk transfer method. Issue #51 --- src/AutoConnect.cpp | 1 - src/AutoConnectPage.cpp | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/AutoConnect.cpp b/src/AutoConnect.cpp index d30e631..bf844c8 100644 --- a/src/AutoConnect.cpp +++ b/src/AutoConnect.cpp @@ -389,7 +389,6 @@ void AutoConnect::_startWebServer(void) { // here, Prepare PageBuilders for captive portal if (!_responsePage) { _responsePage = new PageBuilder(); - _responsePage->chunked(AUTOCONNECT_HTTP_TRANSFER); _responsePage->reserve(AUTOCONNECT_CONTENTBUFFER_SIZE); _responsePage->exitCanHandle(std::bind(&AutoConnect::_classifyHandle, this, std::placeholders::_1, std::placeholders::_2)); _responsePage->onUpload(std::bind(&AutoConnect::_handleUpload, this, std::placeholders::_1, std::placeholders::_2)); diff --git a/src/AutoConnectPage.cpp b/src/AutoConnectPage.cpp index cf37d5a..d93bfc4 100644 --- a/src/AutoConnectPage.cpp +++ b/src/AutoConnectPage.cpp @@ -1259,6 +1259,7 @@ PageElement* AutoConnect::_setupPage(String uri) { elm->addToken(String(FPSTR("FLASH_SIZE")), std::bind(&AutoConnect::_token_FLASH_SIZE, this, std::placeholders::_1)); elm->addToken(String(FPSTR("CHIP_ID")), std::bind(&AutoConnect::_token_CHIP_ID, this, std::placeholders::_1)); elm->addToken(String(FPSTR("FREE_HEAP")), std::bind(&AutoConnect::_token_FREE_HEAP, this, std::placeholders::_1)); + _responsePage->chunked(AUTOCONNECT_HTTP_TRANSFER); } else if (uri == String(AUTOCONNECT_URI_CONFIG)) { @@ -1277,6 +1278,7 @@ PageElement* AutoConnect::_setupPage(String uri) { elm->addToken(String(FPSTR("LIST_SSID")), std::bind(&AutoConnect::_token_LIST_SSID, this, std::placeholders::_1)); elm->addToken(String(FPSTR("SSID_COUNT")), std::bind(&AutoConnect::_token_SSID_COUNT, this, std::placeholders::_1)); elm->addToken(String(FPSTR("HIDDEN_COUNT")), std::bind(&AutoConnect::_token_HIDDEN_COUNT, this, std::placeholders::_1)); + _responsePage->chunked(PB_Chunk); } else if (uri == String(AUTOCONNECT_URI_CONNECT)) { @@ -1291,6 +1293,7 @@ PageElement* AutoConnect::_setupPage(String uri) { elm->addToken(String(FPSTR("MENU_PRE")), std::bind(&AutoConnect::_token_MENU_PRE, this, std::placeholders::_1)); elm->addToken(String(FPSTR("MENU_POST")), std::bind(&AutoConnect::_token_MENU_POST, this, std::placeholders::_1)); elm->addToken(String(FPSTR("CUR_SSID")), std::bind(&AutoConnect::_token_CURRENT_SSID, this, std::placeholders::_1)); + _responsePage->chunked(AUTOCONNECT_HTTP_TRANSFER); } else if (uri == String(AUTOCONNECT_URI_OPEN)) { @@ -1305,6 +1308,7 @@ PageElement* AutoConnect::_setupPage(String uri) { elm->addToken(String(FPSTR("MENU_AUX")), std::bind(&AutoConnect::_token_MENU_AUX, this, std::placeholders::_1)); elm->addToken(String(FPSTR("MENU_POST")), std::bind(&AutoConnect::_token_MENU_POST, this, std::placeholders::_1)); elm->addToken(String(FPSTR("OPEN_SSID")), std::bind(&AutoConnect::_token_OPEN_SSID, this, std::placeholders::_1)); + _responsePage->chunked(AUTOCONNECT_HTTP_TRANSFER); } else if (uri == String(AUTOCONNECT_URI_DISCON)) { @@ -1317,6 +1321,7 @@ PageElement* AutoConnect::_setupPage(String uri) { elm->addToken(String(FPSTR("CSS_LUXBAR")), std::bind(&AutoConnect::_token_CSS_LUXBAR, this, std::placeholders::_1)); elm->addToken(String(FPSTR("MENU_PRE")), std::bind(&AutoConnect::_token_MENU_PRE, this, std::placeholders::_1)); elm->addToken(String(FPSTR("MENU_POST")), std::bind(&AutoConnect::_token_MENU_POST, this, std::placeholders::_1)); + _responsePage->chunked(AUTOCONNECT_HTTP_TRANSFER); } else if (uri == String(AUTOCONNECT_URI_RESET)) { @@ -1326,12 +1331,14 @@ PageElement* AutoConnect::_setupPage(String uri) { elm->addToken(String(FPSTR("BOOTURI")), std::bind(&AutoConnect::_token_BOOTURI, this, std::placeholders::_1)); elm->addToken(String(FPSTR("UPTIME")), std::bind(&AutoConnect::_token_UPTIME, this, std::placeholders::_1)); elm->addToken(String(FPSTR("RESET")), std::bind(&AutoConnect::_induceReset, this, std::placeholders::_1)); + _responsePage->chunked(AUTOCONNECT_HTTP_TRANSFER); } else if (uri == String(AUTOCONNECT_URI_RESULT)) { // Setup /auto/result elm->setMold("{{RESULT}}"); elm->addToken(String(FPSTR("RESULT")), std::bind(&AutoConnect::_invokeResult, this, std::placeholders::_1)); + _responsePage->chunked(AUTOCONNECT_HTTP_TRANSFER); } else if (uri == String(AUTOCONNECT_URI_SUCCESS)) { @@ -1352,6 +1359,7 @@ PageElement* AutoConnect::_setupPage(String uri) { elm->addToken(String(FPSTR("NETMASK")), std::bind(&AutoConnect::_token_NETMASK, this, std::placeholders::_1)); elm->addToken(String(FPSTR("CHANNEL")), std::bind(&AutoConnect::_token_CHANNEL, this, std::placeholders::_1)); elm->addToken(String(FPSTR("DBM")), std::bind(&AutoConnect::_token_DBM, this, std::placeholders::_1)); + _responsePage->chunked(AUTOCONNECT_HTTP_TRANSFER); } else if (uri == String(AUTOCONNECT_URI_FAIL)) { @@ -1366,6 +1374,7 @@ PageElement* AutoConnect::_setupPage(String uri) { elm->addToken(String(FPSTR("MENU_AUX")), std::bind(&AutoConnect::_token_MENU_AUX, this, std::placeholders::_1)); elm->addToken(String(FPSTR("MENU_POST")), std::bind(&AutoConnect::_token_MENU_POST, this, std::placeholders::_1)); elm->addToken(String(FPSTR("STATION_STATUS")), std::bind(&AutoConnect::_token_STATION_STATUS, this, std::placeholders::_1)); + _responsePage->chunked(AUTOCONNECT_HTTP_TRANSFER); } else { delete elm;