diff --git a/README.md b/README.md index f1e2aa1..b793fe0 100644 --- a/README.md +++ b/README.md @@ -1367,7 +1367,7 @@ Following is debug terminal output and screen shot when running example [Advance ``` Start AdvancedWebServer on NUCLEO_F767ZI, using LAN8742A Ethernet & STM32Ethernet Library -EthernetWebServer_STM32 v1.3.1 +EthernetWebServer_STM32 v1.3.2 HTTP EthernetWebServer is @ IP : 192.168.2.117 EthernetWebServer::handleClient: New Client method: GET @@ -1491,7 +1491,7 @@ The following is debug terminal output when running example [WebClientRepeating] ``` Start WebClientRepeating on NUCLEO_F767ZI, using ENC28J60 & EthernetENC Library -EthernetWebServer_STM32 v1.3.1 +EthernetWebServer_STM32 v1.3.2 [ETHERNET_WEBSERVER] Board : NUCLEO_F767ZI , setCsPin: 10 [ETHERNET_WEBSERVER] Default SPI pinout: [ETHERNET_WEBSERVER] MOSI: 11 @@ -1566,7 +1566,7 @@ The following is debug terminal output when running example [UdpNTPClient](examp ``` Start UdpNTPClient on NUCLEO_F767ZI, using W5x00 & Ethernet2 Library -EthernetWebServer_STM32 v1.3.1 +EthernetWebServer_STM32 v1.3.2 [ETHERNET_WEBSERVER] Board : NUCLEO_F767ZI , setCsPin: 10 [ETHERNET_WEBSERVER] Default SPI pinout: [ETHERNET_WEBSERVER] MOSI: 11 @@ -1590,7 +1590,7 @@ The terminal output of **STM32F7 Nucleo-144 NUCLEO_F767ZI with LAN8742A Ethernet ``` Starting SimpleWebSocket on NUCLEO_F767ZI with LAN8742A Ethernet & STM32Ethernet Library -EthernetWebServer_STM32 v1.3.1 +EthernetWebServer_STM32 v1.3.2 [ETHERNET_WEBSERVER] ========================= [ETHERNET_WEBSERVER] Default SPI pinout: [ETHERNET_WEBSERVER] MOSI: 11 @@ -1635,7 +1635,7 @@ The terminal output of **STM32F7 Nucleo-144 NUCLEO_F767ZI with W5x00 & Ethernet3 ``` Starting SimpleWebSocket on NUCLEO_F767ZI with W5x00 & Ethernet3 Library -EthernetWebServer_STM32 v1.3.1 +EthernetWebServer_STM32 v1.3.2 [ETHERNET_WEBSERVER] =========== USE_ETHERNET3 =========== [ETHERNET_WEBSERVER] Default SPI pinout: [ETHERNET_WEBSERVER] MOSI: 11 @@ -1687,7 +1687,7 @@ The terminal output of **STM32F7 Nucleo-144 NUCLEO_F767ZI with LAN8742A Ethernet ``` Starting SimpleHTTPExample on NUCLEO_F767ZI with LAN8742A Ethernet & STM32Ethernet Library -EthernetWebServer_STM32 v1.3.1 +EthernetWebServer_STM32 v1.3.2 [ETHERNET_WEBSERVER] ========================= [ETHERNET_WEBSERVER] Default SPI pinout: [ETHERNET_WEBSERVER] MOSI: 11 @@ -1760,7 +1760,7 @@ The terminal output of **STM32F7 Nucleo-144 NUCLEO_F767ZI with LAN8742A Ethernet ``` Start MQTTClient_Auth on NUCLEO_F767ZI with LAN8742A Ethernet & STM32Ethernet Library -EthernetWebServer_STM32 v1.3.1 +EthernetWebServer_STM32 v1.3.2 [ETHERNET_WEBSERVER] ========================= [ETHERNET_WEBSERVER] Default SPI pinout: [ETHERNET_WEBSERVER] MOSI: 11 @@ -1799,7 +1799,7 @@ The terminal output of **STM32F7 Nucleo-144 NUCLEO_F767ZI with ENC28J60 & Ethern ``` Start MQTTClient_Auth on NUCLEO_F767ZI with ENC28J60 & EthernetENC Library -EthernetWebServer_STM32 v1.3.1 +EthernetWebServer_STM32 v1.3.2 [ETHERNET_WEBSERVER] =========== USE_ETHERNET_ENC =========== [ETHERNET_WEBSERVER] Default SPI pinout: [ETHERNET_WEBSERVER] MOSI: 11 @@ -1838,7 +1838,7 @@ The terminal output of **STM32F7 Nucleo-144 NUCLEO_F767ZI with W5x00 & Ethernet2 ``` Start MQTTClient_Auth on NUCLEO_F767ZI with W5x00 & Ethernet2 Library -EthernetWebServer_STM32 v1.3.1 +EthernetWebServer_STM32 v1.3.2 [ETHERNET_WEBSERVER] =========== USE_ETHERNET2 =========== [ETHERNET_WEBSERVER] Default SPI pinout: [ETHERNET_WEBSERVER] MOSI: 11 @@ -1872,7 +1872,7 @@ The terminal output of **STM32F4 BLACK_F407VE with LAN8720 Ethernet and STM32Eth ``` Starting SimpleWebSocket_LAN8720 on BLACK_F407VE with LAN8720 Ethernet & STM32Ethernet Library -EthernetWebServer_STM32 v1.3.1 +EthernetWebServer_STM32 v1.3.2 Using mac index = 6 Connected! IP address: 192.168.2.138 starting WebSocket client @@ -1897,7 +1897,7 @@ The terminal output of **BLACK_F407VE using LAN8720 Ethernet and STM32Ethernet L ``` Start WebClient_LAN8720 on BLACK_F407VE, using LAN8720 Ethernet & STM32Ethernet Library -EthernetWebServer_STM32 v1.3.1 +EthernetWebServer_STM32 v1.3.2 You're connected to the network, IP = 192.168.2.139 Starting connection to server... @@ -1970,7 +1970,7 @@ Following is debug terminal output and screen shot when running example [Advance ``` Start AdvancedWebServer_LAN8720 on BLACK_F407VE, using LAN8720 Ethernet & STM32Ethernet Library -EthernetWebServer_STM32 v1.3.1 +EthernetWebServer_STM32 v1.3.2 .[EWS] String Len = 0, extend to 2048 ......... .......... .......... .......... .......... .......... .......... .......... ``` diff --git a/changelog.md b/changelog.md index e303187..4259941 100644 --- a/changelog.md +++ b/changelog.md @@ -12,6 +12,7 @@ ## Table of Contents * [Changelog](#changelog) + * [Releases v1.3.2](#releases-v132) * [Releases v1.3.1](#releases-v131) * [Major Releases v1.3.0](#major-releases-v130) * [Releases v1.2.1](#releases-v121) @@ -30,6 +31,11 @@ ## Changelog +### Releases v1.3.2 + +1. Fix wrong http status header bug. Check [fix for wrong http status header #42](https://github.com/khoih-prog/EthernetWebServer/pull/42) +2. Fix authenticate issue caused by libb64 + ### Releases v1.3.1 1. Fix bug related to String in examples diff --git a/library.json b/library.json index 0f552db..d1a3a33 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "EthernetWebServer_STM32", - "version": "1.3.1", + "version": "1.3.2", "keywords": "WebServer, built-in-Ethernet, STM32F, STM32L, STM32H, STM32G, STM32WB, STM32MP1, Ethernet-shield, Nucleo-144, Nucleo-64, Nucleo-32, LAN8742A, LAN8720, ENC28J60, W5x00, W5500, W5100, Ethernet, Ethernet2, Ethernet3, EthernetLarge, EtnernetENC, UIPEthernet, HTTP-Client, WebSocket-Client, server, client, websocket", "description": "Simple Ethernet WebServer, HTTP Client and WebSocket Client library for STM32F/L/H/G/WB/MP1 boards running built-in Ethernet LAN8742A, LAN8720 or Ethernet W5x00, ENC28J60 shields", "authors": diff --git a/library.properties b/library.properties index 8ccbf69..4065ec6 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=EthernetWebServer_STM32 -version=1.3.1 +version=1.3.2 author=Khoi Hoang license=MIT maintainer=Khoi Hoang diff --git a/src/EthernetHttpClient_STM32.h b/src/EthernetHttpClient_STM32.h index 1242d23..0ef5ce9 100644 --- a/src/EthernetHttpClient_STM32.h +++ b/src/EthernetHttpClient_STM32.h @@ -12,7 +12,7 @@ @file Esp8266WebServer.h @author Ivan Grokhotkov - Version: 1.3.1 + Version: 1.3.2 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -30,6 +30,7 @@ 1.2.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.3.0 K Hoang 20/12/2021 Reduce usage of Arduino String with std::string. Use reference passing instead of value-passing 1.3.1 K Hoang 25/12/2021 Fix bug + 1.3.2 K Hoang 28/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 *************************************************************************************************************************************/ // Library to simplify HTTP fetching on Arduino diff --git a/src/EthernetWebServer_STM32-impl.h b/src/EthernetWebServer_STM32-impl.h index 1fabf7f..8684098 100644 --- a/src/EthernetWebServer_STM32-impl.h +++ b/src/EthernetWebServer_STM32-impl.h @@ -12,7 +12,7 @@ @file Esp8266WebServer.h @author Ivan Grokhotkov - Version: 1.3.1 + Version: 1.3.2 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -30,6 +30,7 @@ 1.2.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.3.0 K Hoang 20/12/2021 Reduce usage of Arduino String with std::string. Use reference passing instead of value-passing 1.3.1 K Hoang 25/12/2021 Fix bug + 1.3.2 K Hoang 28/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 *************************************************************************************************************************************/ #pragma once @@ -422,7 +423,7 @@ void EthernetWebServer::_prepareHeader(String& response, int code, const char* c EWString aResponse = fromString(response); aResponse = "HTTP/1." + fromString(String(_currentVersion)) + " "; - aResponse += code; + aResponse += fromString(String(code)); aResponse += " "; aResponse += fromString(_responseCodeToString(code)); aResponse += RETURN_NEWLINE; @@ -466,7 +467,7 @@ void EthernetWebServer::_prepareHeader(String& response, int code, const char* c void EthernetWebServer::_prepareHeader(EWString& response, int code, const char* content_type, size_t contentLength) { response = "HTTP/1." + fromString(String(_currentVersion)) + " "; - response += code; + response += fromString(String(code)); response += " "; response += fromString(_responseCodeToString(code)); response += RETURN_NEWLINE; diff --git a/src/EthernetWebServer_STM32.h b/src/EthernetWebServer_STM32.h index e195ff3..3f72dcd 100644 --- a/src/EthernetWebServer_STM32.h +++ b/src/EthernetWebServer_STM32.h @@ -12,7 +12,7 @@ @file Esp8266WebServer.h @author Ivan Grokhotkov - Version: 1.3.1 + Version: 1.3.2 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -30,6 +30,7 @@ 1.2.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.3.0 K Hoang 20/12/2021 Reduce usage of Arduino String with std::string. Use reference passing instead of value-passing 1.3.1 K Hoang 25/12/2021 Fix bug + 1.3.2 K Hoang 28/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 *************************************************************************************************************************************/ #pragma once @@ -58,13 +59,13 @@ #endif -#define ETHERNET_WEBSERVER_STM32_VERSION "EthernetWebServer_STM32 v1.3.1" +#define ETHERNET_WEBSERVER_STM32_VERSION "EthernetWebServer_STM32 v1.3.2" #define ETHERNET_WEBSERVER_STM32_VERSION_MAJOR 1 #define ETHERNET_WEBSERVER_STM32_VERSION_MINOR 3 -#define ETHERNET_WEBSERVER_STM32_VERSION_PATCH 1 +#define ETHERNET_WEBSERVER_STM32_VERSION_PATCH 2 -#define ETHERNET_WEBSERVER_STM32_VERSION_INT 1003001 +#define ETHERNET_WEBSERVER_STM32_VERSION_INT 1003002 #define USE_NEW_WEBSERVER_VERSION true diff --git a/src/Ethernet_HTTPClient/Ethernet_HttpClient.cpp b/src/Ethernet_HTTPClient/Ethernet_HttpClient.cpp index 31a852c..828a71d 100644 --- a/src/Ethernet_HTTPClient/Ethernet_HttpClient.cpp +++ b/src/Ethernet_HTTPClient/Ethernet_HttpClient.cpp @@ -12,7 +12,7 @@ @file Esp8266WebServer.h @author Ivan Grokhotkov - Version: 1.3.1 + Version: 1.3.2 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -30,6 +30,7 @@ 1.2.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.3.0 K Hoang 20/12/2021 Reduce usage of Arduino String with std::string. Use reference passing instead of value-passing 1.3.1 K Hoang 25/12/2021 Fix bug + 1.3.2 K Hoang 28/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 *************************************************************************************************************************************/ // Class to simplify HTTP fetching on Arduino diff --git a/src/Ethernet_HTTPClient/Ethernet_HttpClient.h b/src/Ethernet_HTTPClient/Ethernet_HttpClient.h index 0df4779..e9d6941 100644 --- a/src/Ethernet_HTTPClient/Ethernet_HttpClient.h +++ b/src/Ethernet_HTTPClient/Ethernet_HttpClient.h @@ -12,7 +12,7 @@ @file Esp8266WebServer.h @author Ivan Grokhotkov - Version: 1.3.1 + Version: 1.3.2 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -30,6 +30,7 @@ 1.2.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.3.0 K Hoang 20/12/2021 Reduce usage of Arduino String with std::string. Use reference passing instead of value-passing 1.3.1 K Hoang 25/12/2021 Fix bug + 1.3.2 K Hoang 28/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 *************************************************************************************************************************************/ // Class to simplify HTTP fetching on Arduino diff --git a/src/Ethernet_HTTPClient/Ethernet_URLEncoder.cpp b/src/Ethernet_HTTPClient/Ethernet_URLEncoder.cpp index d040513..8257311 100644 --- a/src/Ethernet_HTTPClient/Ethernet_URLEncoder.cpp +++ b/src/Ethernet_HTTPClient/Ethernet_URLEncoder.cpp @@ -12,7 +12,7 @@ @file Esp8266WebServer.h @author Ivan Grokhotkov - Version: 1.3.1 + Version: 1.3.2 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -30,6 +30,7 @@ 1.2.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.3.0 K Hoang 20/12/2021 Reduce usage of Arduino String with std::string. Use reference passing instead of value-passing 1.3.1 K Hoang 25/12/2021 Fix bug + 1.3.2 K Hoang 28/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 *************************************************************************************************************************************/ // Library to simplify HTTP fetching on Arduino diff --git a/src/Ethernet_HTTPClient/Ethernet_URLEncoder.h b/src/Ethernet_HTTPClient/Ethernet_URLEncoder.h index 5b94b03..1171700 100644 --- a/src/Ethernet_HTTPClient/Ethernet_URLEncoder.h +++ b/src/Ethernet_HTTPClient/Ethernet_URLEncoder.h @@ -12,7 +12,7 @@ @file Esp8266WebServer.h @author Ivan Grokhotkov - Version: 1.3.1 + Version: 1.3.2 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -30,6 +30,7 @@ 1.2.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.3.0 K Hoang 20/12/2021 Reduce usage of Arduino String with std::string. Use reference passing instead of value-passing 1.3.1 K Hoang 25/12/2021 Fix bug + 1.3.2 K Hoang 28/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 *************************************************************************************************************************************/ // Library to simplify HTTP fetching on Arduino diff --git a/src/Ethernet_HTTPClient/Ethernet_WebSocketClient.cpp b/src/Ethernet_HTTPClient/Ethernet_WebSocketClient.cpp index 79b358c..b974b7f 100644 --- a/src/Ethernet_HTTPClient/Ethernet_WebSocketClient.cpp +++ b/src/Ethernet_HTTPClient/Ethernet_WebSocketClient.cpp @@ -12,7 +12,7 @@ @file Esp8266WebServer.h @author Ivan Grokhotkov - Version: 1.3.1 + Version: 1.3.2 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -30,6 +30,7 @@ 1.2.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.3.0 K Hoang 20/12/2021 Reduce usage of Arduino String with std::string. Use reference passing instead of value-passing 1.3.1 K Hoang 25/12/2021 Fix bug + 1.3.2 K Hoang 28/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 *************************************************************************************************************************************/ // (c) Copyright Arduino. 2016 diff --git a/src/Ethernet_HTTPClient/Ethernet_WebSocketClient.h b/src/Ethernet_HTTPClient/Ethernet_WebSocketClient.h index 49a1769..f5c2eca 100644 --- a/src/Ethernet_HTTPClient/Ethernet_WebSocketClient.h +++ b/src/Ethernet_HTTPClient/Ethernet_WebSocketClient.h @@ -12,7 +12,7 @@ @file Esp8266WebServer.h @author Ivan Grokhotkov - Version: 1.3.1 + Version: 1.3.2 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -30,6 +30,7 @@ 1.2.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.3.0 K Hoang 20/12/2021 Reduce usage of Arduino String with std::string. Use reference passing instead of value-passing 1.3.1 K Hoang 25/12/2021 Fix bug + 1.3.2 K Hoang 28/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 *************************************************************************************************************************************/ // (c) Copyright Arduino. 2016 diff --git a/src/Parsing_STM32-impl.h b/src/Parsing_STM32-impl.h index 9c26542..a0c2bc3 100644 --- a/src/Parsing_STM32-impl.h +++ b/src/Parsing_STM32-impl.h @@ -12,7 +12,7 @@ @file Esp8266WebServer.h @author Ivan Grokhotkov - Version: 1.3.1 + Version: 1.3.2 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -30,6 +30,7 @@ 1.2.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.3.0 K Hoang 20/12/2021 Reduce usage of Arduino String with std::string. Use reference passing instead of value-passing 1.3.1 K Hoang 25/12/2021 Fix bug + 1.3.2 K Hoang 28/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 *************************************************************************************************************************************/ #pragma once diff --git a/src/detail/Debug_STM32.h b/src/detail/Debug_STM32.h index a9b3408..80e6b6f 100644 --- a/src/detail/Debug_STM32.h +++ b/src/detail/Debug_STM32.h @@ -12,7 +12,7 @@ @file Esp8266WebServer.h @author Ivan Grokhotkov - Version: 1.3.1 + Version: 1.3.2 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -30,6 +30,7 @@ 1.2.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.3.0 K Hoang 20/12/2021 Reduce usage of Arduino String with std::string. Use reference passing instead of value-passing 1.3.1 K Hoang 25/12/2021 Fix bug + 1.3.2 K Hoang 28/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 *************************************************************************************************************************************/ #pragma once diff --git a/src/detail/RequestHandler_STM32.h b/src/detail/RequestHandler_STM32.h index 1efd9f8..06f1fb6 100644 --- a/src/detail/RequestHandler_STM32.h +++ b/src/detail/RequestHandler_STM32.h @@ -12,7 +12,7 @@ @file Esp8266WebServer.h @author Ivan Grokhotkov - Version: 1.3.1 + Version: 1.3.2 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -30,6 +30,7 @@ 1.2.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.3.0 K Hoang 20/12/2021 Reduce usage of Arduino String with std::string. Use reference passing instead of value-passing 1.3.1 K Hoang 25/12/2021 Fix bug + 1.3.2 K Hoang 28/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 *************************************************************************************************************************************/ #pragma once diff --git a/src/detail/RequestHandlersImpl_STM32.h b/src/detail/RequestHandlersImpl_STM32.h index 9ca7a9e..608012a 100644 --- a/src/detail/RequestHandlersImpl_STM32.h +++ b/src/detail/RequestHandlersImpl_STM32.h @@ -12,7 +12,7 @@ @file Esp8266WebServer.h @author Ivan Grokhotkov - Version: 1.3.1 + Version: 1.3.2 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -30,6 +30,7 @@ 1.2.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.3.0 K Hoang 20/12/2021 Reduce usage of Arduino String with std::string. Use reference passing instead of value-passing 1.3.1 K Hoang 25/12/2021 Fix bug + 1.3.2 K Hoang 28/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 *************************************************************************************************************************************/ #pragma once diff --git a/src/detail/mimetable.h b/src/detail/mimetable.h index e130ba0..cf76884 100644 --- a/src/detail/mimetable.h +++ b/src/detail/mimetable.h @@ -12,7 +12,7 @@ @file Esp8266WebServer.h @author Ivan Grokhotkov - Version: 1.3.1 + Version: 1.3.2 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -30,6 +30,7 @@ 1.2.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.3.0 K Hoang 20/12/2021 Reduce usage of Arduino String with std::string. Use reference passing instead of value-passing 1.3.1 K Hoang 25/12/2021 Fix bug + 1.3.2 K Hoang 28/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 *************************************************************************************************************************************/ #pragma once diff --git a/src/libb64/base64.cpp b/src/libb64/base64.cpp index 562cf31..75cb543 100644 --- a/src/libb64/base64.cpp +++ b/src/libb64/base64.cpp @@ -12,7 +12,7 @@ @file Esp8266WebServer.h @author Ivan Grokhotkov - Version: 1.3.1 + Version: 1.3.2 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -30,6 +30,7 @@ 1.2.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.3.0 K Hoang 20/12/2021 Reduce usage of Arduino String with std::string. Use reference passing instead of value-passing 1.3.1 K Hoang 25/12/2021 Fix bug + 1.3.2 K Hoang 28/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 *************************************************************************************************************************************/ #include "base64.h" diff --git a/src/libb64/base64.h b/src/libb64/base64.h index 23b0d9e..0206081 100644 --- a/src/libb64/base64.h +++ b/src/libb64/base64.h @@ -12,7 +12,7 @@ @file Esp8266WebServer.h @author Ivan Grokhotkov - Version: 1.3.1 + Version: 1.3.2 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -30,6 +30,7 @@ 1.2.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.3.0 K Hoang 20/12/2021 Reduce usage of Arduino String with std::string. Use reference passing instead of value-passing 1.3.1 K Hoang 25/12/2021 Fix bug + 1.3.2 K Hoang 28/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 *************************************************************************************************************************************/ #pragma once diff --git a/src/libb64/cdecode.c b/src/libb64/cdecode.c index 9da5ca1..110d5ac 100644 --- a/src/libb64/cdecode.c +++ b/src/libb64/cdecode.c @@ -1,9 +1,5 @@ /**************************************************************************************************************************** - cdecode.c - c source to a base64 decoding algorithm implementation - - This is part of the libb64 project, and has been placed in the public domain. - For details, see http://sourceforge.net/projects/libb64 - + cdecoder.c - c source to a base64 decoding algorithm implementation For STM32 with built-in Ethernet LAN8742A (Nucleo-144, DISCOVERY, etc) or W5x00/ENC28J60 shield/module EthernetWebServer_STM32 is a library for the STM32 running Ethernet WebServer @@ -16,7 +12,7 @@ @file Esp8266WebServer.h @author Ivan Grokhotkov - Version: 1.3.1 + Version: 1.3.2 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -34,25 +30,27 @@ 1.2.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.3.0 K Hoang 20/12/2021 Reduce usage of Arduino String with std::string. Use reference passing instead of value-passing 1.3.1 K Hoang 25/12/2021 Fix bug - *************************************************************************************************************************************/ + 1.3.2 K Hoang 28/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 + *****************************************************************************************************************************/ #include "cdecode.h" int base64_decode_value(char value_in) { - static const char decoding[] = {62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -2, -1, -1, -1, 0, 1, 2, - 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, - -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51 - }; - static const char decoding_size = sizeof(decoding); + static const char decoding[] = + { 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -2, -1, -1, -1, 0, 1, 2, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, + -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51 + }; - int newValue = (int) value_in - 43; + static const char decoding_size = sizeof(decoding); + value_in -= 43; - if (newValue < 0 || newValue > decoding_size) + if (value_in < 0 || value_in > decoding_size) return -1; - - return decoding[newValue]; + + return decoding[(int)value_in]; } void base64_init_decodestate(base64_decodestate* state_in) @@ -61,13 +59,11 @@ void base64_init_decodestate(base64_decodestate* state_in) state_in->plainchar = 0; } - int base64_decode_block(const char* code_in, const int length_in, char* plaintext_out, base64_decodestate* state_in) { const char* codechar = code_in; char* plainchar = plaintext_out; - //char fragment; - int fragment; + char fragment; *plainchar = state_in->plainchar; @@ -85,13 +81,11 @@ int base64_decode_block(const char* code_in, const int length_in, char* plaintex return plainchar - plaintext_out; } - fragment = base64_decode_value(*codechar++); + fragment = (char)base64_decode_value(*codechar++); } while (fragment < 0); *plainchar = (fragment & 0x03f) << 2; - break; - case step_b: do { @@ -102,14 +96,12 @@ int base64_decode_block(const char* code_in, const int length_in, char* plaintex return plainchar - plaintext_out; } - fragment = base64_decode_value(*codechar++); + fragment = (char)base64_decode_value(*codechar++); } while (fragment < 0); *plainchar++ |= (fragment & 0x030) >> 4; *plainchar = (fragment & 0x00f) << 4; - break; - case step_c: do { @@ -120,14 +112,12 @@ int base64_decode_block(const char* code_in, const int length_in, char* plaintex return plainchar - plaintext_out; } - fragment = base64_decode_value(*codechar++); + fragment = (char)base64_decode_value(*codechar++); } while (fragment < 0); *plainchar++ |= (fragment & 0x03c) >> 2; *plainchar = (fragment & 0x003) << 6; - break; - case step_d: do { @@ -138,22 +128,19 @@ int base64_decode_block(const char* code_in, const int length_in, char* plaintex return plainchar - plaintext_out; } - fragment = base64_decode_value(*codechar++); + fragment = (char)base64_decode_value(*codechar++); } while (fragment < 0); *plainchar++ |= (fragment & 0x03f); - - break; } - } /* control should not reach here */ return plainchar - plaintext_out; } -int base64_decode_chars(const char* code_in, const int length_in, char* plaintext_out) -{ +int base64_decode_chars(const char* code_in, const int length_in, char* plaintext_out) { + base64_decodestate _state; base64_init_decodestate(&_state); int len = base64_decode_block(code_in, length_in, plaintext_out, &_state); diff --git a/src/libb64/cdecode.h b/src/libb64/cdecode.h index c8e2df9..827d0a2 100644 --- a/src/libb64/cdecode.h +++ b/src/libb64/cdecode.h @@ -1,9 +1,5 @@ /**************************************************************************************************************************** - cdecode.h - c header for a base64 decoding algorithm - - This is part of the libb64 project, and has been placed in the public domain. - For details, see http://sourceforge.net/projects/libb64 - + cdecoder.h - c source to a base64 decoding algorithm implementation For STM32 with built-in Ethernet LAN8742A (Nucleo-144, DISCOVERY, etc) or W5x00/ENC28J60 shield/module EthernetWebServer_STM32 is a library for the STM32 running Ethernet WebServer @@ -16,7 +12,7 @@ @file Esp8266WebServer.h @author Ivan Grokhotkov - Version: 1.3.1 + Version: 1.3.2 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -34,7 +30,8 @@ 1.2.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.3.0 K Hoang 20/12/2021 Reduce usage of Arduino String with std::string. Use reference passing instead of value-passing 1.3.1 K Hoang 25/12/2021 Fix bug - *************************************************************************************************************************************/ + 1.3.2 K Hoang 28/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 + *****************************************************************************************************************************/ #pragma once diff --git a/src/libb64/cencode.c b/src/libb64/cencode.c index df5f854..5ec6f09 100644 --- a/src/libb64/cencode.c +++ b/src/libb64/cencode.c @@ -1,9 +1,5 @@ /**************************************************************************************************************************** - cencode.c - c source to a base64 encoding algorithm implementation - - This is part of the libb64 project, and has been placed in the public domain. - For details, see http://sourceforge.net/projects/libb64 - + cencoder.c - c source to a base64 decoding algorithm implementation For STM32 with built-in Ethernet LAN8742A (Nucleo-144, DISCOVERY, etc) or W5x00/ENC28J60 shield/module EthernetWebServer_STM32 is a library for the STM32 running Ethernet WebServer @@ -16,7 +12,7 @@ @file Esp8266WebServer.h @author Ivan Grokhotkov - Version: 1.3.1 + Version: 1.3.2 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -34,8 +30,9 @@ 1.2.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.3.0 K Hoang 20/12/2021 Reduce usage of Arduino String with std::string. Use reference passing instead of value-passing 1.3.1 K Hoang 25/12/2021 Fix bug - *************************************************************************************************************************************/ - + 1.3.2 K Hoang 28/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 + *****************************************************************************************************************************/ + #include "cencode.h" const int CHARS_PER_LINE = 72; @@ -62,8 +59,8 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out, const char* plainchar = plaintext_in; const char* const plaintextend = plaintext_in + length_in; char* codechar = code_out; - char result; - char fragment; + char result; + char fragment; result = state_in->result; @@ -72,7 +69,6 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out, while (1) { case step_A: - if (plainchar == plaintextend) { state_in->result = result; @@ -85,10 +81,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out, *codechar++ = base64_encode_value(result); result = (fragment & 0x003) << 4; - break; - case step_B: - if (plainchar == plaintextend) { state_in->result = result; @@ -101,10 +94,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out, *codechar++ = base64_encode_value(result); result = (fragment & 0x00f) << 2; - break; - case step_C: - if (plainchar == plaintextend) { state_in->result = result; @@ -125,8 +115,6 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out, *codechar++ = '\n'; state_in->stepcount = 0; } - - break; } } @@ -164,5 +152,5 @@ int base64_encode_chars(const char* plaintext_in, int length_in, char* code_out) base64_init_encodestate(&_state); int len = base64_encode_block(plaintext_in, length_in, code_out, &_state); - return ( len + base64_encode_blockend((code_out + len), &_state) ); + return len + base64_encode_blockend((code_out + len), &_state); } diff --git a/src/libb64/cencode.h b/src/libb64/cencode.h index 6868203..4ab0c78 100644 --- a/src/libb64/cencode.h +++ b/src/libb64/cencode.h @@ -1,9 +1,5 @@ /**************************************************************************************************************************** - cencode.h - c header for a base64 encoding algorithm - - This is part of the libb64 project, and has been placed in the public domain. - For details, see http://sourceforge.net/projects/libb64 - + cencoder.h - c source to a base64 decoding algorithm implementation For STM32 with built-in Ethernet LAN8742A (Nucleo-144, DISCOVERY, etc) or W5x00/ENC28J60 shield/module EthernetWebServer_STM32 is a library for the STM32 running Ethernet WebServer @@ -16,7 +12,7 @@ @file Esp8266WebServer.h @author Ivan Grokhotkov - Version: 1.3.1 + Version: 1.3.2 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -34,7 +30,8 @@ 1.2.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.3.0 K Hoang 20/12/2021 Reduce usage of Arduino String with std::string. Use reference passing instead of value-passing 1.3.1 K Hoang 25/12/2021 Fix bug - *************************************************************************************************************************************/ + 1.3.2 K Hoang 28/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 + *****************************************************************************************************************************/ #pragma once