diff --git a/src/EthernetHttpClient_SSL_STM32.h b/src/EthernetHttpClient_SSL_STM32.h index 2728be8..614e6dc 100644 --- a/src/EthernetHttpClient_SSL_STM32.h +++ b/src/EthernetHttpClient_SSL_STM32.h @@ -8,7 +8,7 @@ Built by Khoi Hoang https://github.com/khoih-prog/EthernetWebServer_STM32 Licensed under MIT license - Version: 1.4.0 + Version: 1.4.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -21,6 +21,7 @@ 1.3.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7 1.3.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.4.0 K Hoang 25/12/2021 Reduce usage of Arduino String with std::string. Fix bug + 1.4.1 K Hoang 27/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_SSL_STM32-impl.h b/src/EthernetWebServer_SSL_STM32-impl.h index 70209ac..4f51eed 100644 --- a/src/EthernetWebServer_SSL_STM32-impl.h +++ b/src/EthernetWebServer_SSL_STM32-impl.h @@ -11,7 +11,7 @@ Licensed under MIT license - Version: 1.4.0 + Version: 1.4.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -24,6 +24,7 @@ 1.3.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7 1.3.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.4.0 K Hoang 25/12/2021 Reduce usage of Arduino String with std::string. Fix bug + 1.4.1 K Hoang 27/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 *************************************************************************************************************************************/ #pragma once @@ -412,7 +413,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; @@ -456,7 +457,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_SSL_STM32.h b/src/EthernetWebServer_SSL_STM32.h index 828359a..bf5927c 100644 --- a/src/EthernetWebServer_SSL_STM32.h +++ b/src/EthernetWebServer_SSL_STM32.h @@ -11,7 +11,7 @@ Licensed under MIT license - Version: 1.4.0 + Version: 1.4.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -24,6 +24,7 @@ 1.3.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7 1.3.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.4.0 K Hoang 25/12/2021 Reduce usage of Arduino String with std::string. Fix bug + 1.4.1 K Hoang 27/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 *************************************************************************************************************************************/ #pragma once @@ -34,13 +35,13 @@ #error This code is designed to run on STM32F/L/H/G/WB/MP1 platform! Please check your Tools->Board setting. #endif -#define ETHERNET_WEBSERVER_SSL_STM32_VERSION "EthernetWebServer_SSL_STM32 v1.4.0" +#define ETHERNET_WEBSERVER_SSL_STM32_VERSION "EthernetWebServer_SSL_STM32 v1.4.1" #define ETHERNET_WEBSERVER_SSL_STM32_VERSION_MAJOR 1 #define ETHERNET_WEBSERVER_SSL_STM32_VERSION_MINOR 4 -#define ETHERNET_WEBSERVER_SSL_STM32_VERSION_PATCH 0 +#define ETHERNET_WEBSERVER_SSL_STM32_VERSION_PATCH 1 -#define ETHERNET_WEBSERVER_SSL_STM32_VERSION_INT 1004000 +#define ETHERNET_WEBSERVER_SSL_STM32_VERSION_INT 1004001 #define USE_NEW_WEBSERVER_VERSION true diff --git a/src/Ethernet_HTTPClient/Ethernet_HttpClient.cpp b/src/Ethernet_HTTPClient/Ethernet_HttpClient.cpp index 2ca6ef1..4a09dfa 100644 --- a/src/Ethernet_HTTPClient/Ethernet_HttpClient.cpp +++ b/src/Ethernet_HTTPClient/Ethernet_HttpClient.cpp @@ -11,7 +11,7 @@ Licensed under MIT license - Version: 1.4.0 + Version: 1.4.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -24,6 +24,7 @@ 1.3.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7 1.3.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.4.0 K Hoang 25/12/2021 Reduce usage of Arduino String with std::string. Fix bug + 1.4.1 K Hoang 27/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 b5b0c36..5692e3c 100644 --- a/src/Ethernet_HTTPClient/Ethernet_HttpClient.h +++ b/src/Ethernet_HTTPClient/Ethernet_HttpClient.h @@ -11,7 +11,7 @@ Licensed under MIT license - Version: 1.4.0 + Version: 1.4.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -24,6 +24,7 @@ 1.3.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7 1.3.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.4.0 K Hoang 25/12/2021 Reduce usage of Arduino String with std::string. Fix bug + 1.4.1 K Hoang 27/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 d4621f7..4b4f345 100644 --- a/src/Ethernet_HTTPClient/Ethernet_URLEncoder.cpp +++ b/src/Ethernet_HTTPClient/Ethernet_URLEncoder.cpp @@ -11,7 +11,7 @@ Licensed under MIT license - Version: 1.4.0 + Version: 1.4.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -24,6 +24,7 @@ 1.3.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7 1.3.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.4.0 K Hoang 25/12/2021 Reduce usage of Arduino String with std::string. Fix bug + 1.4.1 K Hoang 27/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 cf12ee5..31ef2ab 100644 --- a/src/Ethernet_HTTPClient/Ethernet_URLEncoder.h +++ b/src/Ethernet_HTTPClient/Ethernet_URLEncoder.h @@ -11,7 +11,7 @@ Licensed under MIT license - Version: 1.4.0 + Version: 1.4.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -24,6 +24,7 @@ 1.3.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7 1.3.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.4.0 K Hoang 25/12/2021 Reduce usage of Arduino String with std::string. Fix bug + 1.4.1 K Hoang 27/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 adf9248..066bf81 100644 --- a/src/Ethernet_HTTPClient/Ethernet_WebSocketClient.cpp +++ b/src/Ethernet_HTTPClient/Ethernet_WebSocketClient.cpp @@ -11,7 +11,7 @@ Licensed under MIT license - Version: 1.4.0 + Version: 1.4.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -24,6 +24,7 @@ 1.3.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7 1.3.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.4.0 K Hoang 25/12/2021 Reduce usage of Arduino String with std::string. Fix bug + 1.4.1 K Hoang 27/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 d61d5e9..90ba338 100644 --- a/src/Ethernet_HTTPClient/Ethernet_WebSocketClient.h +++ b/src/Ethernet_HTTPClient/Ethernet_WebSocketClient.h @@ -11,7 +11,7 @@ Licensed under MIT license - Version: 1.4.0 + Version: 1.4.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -24,6 +24,7 @@ 1.3.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7 1.3.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.4.0 K Hoang 25/12/2021 Reduce usage of Arduino String with std::string. Fix bug + 1.4.1 K Hoang 27/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 *************************************************************************************************************************************/ // (c) Copyright Arduino. 2016 diff --git a/src/Parsing_SSL_STM32-impl.h b/src/Parsing_SSL_STM32-impl.h index f23e7bf..11f6d28 100644 --- a/src/Parsing_SSL_STM32-impl.h +++ b/src/Parsing_SSL_STM32-impl.h @@ -11,7 +11,7 @@ Licensed under MIT license - Version: 1.4.0 + Version: 1.4.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -24,6 +24,7 @@ 1.3.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7 1.3.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.4.0 K Hoang 25/12/2021 Reduce usage of Arduino String with std::string. Fix bug + 1.4.1 K Hoang 27/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 a65c9f8..1dd6c7d 100644 --- a/src/detail/Debug_STM32.h +++ b/src/detail/Debug_STM32.h @@ -11,7 +11,7 @@ Licensed under MIT license - Version: 1.4.0 + Version: 1.4.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -24,6 +24,7 @@ 1.3.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7 1.3.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.4.0 K Hoang 25/12/2021 Reduce usage of Arduino String with std::string. Fix bug + 1.4.1 K Hoang 27/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 b136946..78a836e 100644 --- a/src/detail/RequestHandler_STM32.h +++ b/src/detail/RequestHandler_STM32.h @@ -11,7 +11,7 @@ Licensed under MIT license - Version: 1.4.0 + Version: 1.4.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -24,6 +24,7 @@ 1.3.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7 1.3.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.4.0 K Hoang 25/12/2021 Reduce usage of Arduino String with std::string. Fix bug + 1.4.1 K Hoang 27/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 f30df56..ec430fd 100644 --- a/src/detail/RequestHandlersImpl_STM32.h +++ b/src/detail/RequestHandlersImpl_STM32.h @@ -11,7 +11,7 @@ Licensed under MIT license - Version: 1.4.0 + Version: 1.4.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -24,6 +24,7 @@ 1.3.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7 1.3.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.4.0 K Hoang 25/12/2021 Reduce usage of Arduino String with std::string. Fix bug + 1.4.1 K Hoang 27/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 b250a46..40b2468 100644 --- a/src/detail/mimetable.h +++ b/src/detail/mimetable.h @@ -11,7 +11,7 @@ Licensed under MIT license - Version: 1.4.0 + Version: 1.4.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -24,6 +24,7 @@ 1.3.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7 1.3.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.4.0 K Hoang 25/12/2021 Reduce usage of Arduino String with std::string. Fix bug + 1.4.1 K Hoang 27/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 *************************************************************************************************************************************/ #ifndef __MIMETABLE_H__ diff --git a/src/inner.h b/src/inner.h index b180e2e..0abbf8c 100644 --- a/src/inner.h +++ b/src/inner.h @@ -12,7 +12,7 @@ Licensed under MIT license - Version: 1.4.0 + Version: 1.4.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -25,6 +25,7 @@ 1.3.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7 1.3.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.4.0 K Hoang 25/12/2021 Reduce usage of Arduino String with std::string. Fix bug + 1.4.1 K Hoang 27/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 *************************************************************************************************************************************/ #include "SSLClient/inner.h" diff --git a/src/libb64/base64.cpp b/src/libb64/base64.cpp index 3b37295..1f2b3c4 100644 --- a/src/libb64/base64.cpp +++ b/src/libb64/base64.cpp @@ -12,7 +12,7 @@ Licensed under MIT license - Version: 1.4.0 + Version: 1.4.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -25,6 +25,7 @@ 1.3.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7 1.3.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.4.0 K Hoang 25/12/2021 Reduce usage of Arduino String with std::string. Fix bug + 1.4.1 K Hoang 27/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 211261b..81e7645 100644 --- a/src/libb64/base64.h +++ b/src/libb64/base64.h @@ -12,7 +12,7 @@ Licensed under MIT license - Version: 1.4.0 + Version: 1.4.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -25,6 +25,7 @@ 1.3.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7 1.3.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.4.0 K Hoang 25/12/2021 Reduce usage of Arduino String with std::string. Fix bug + 1.4.1 K Hoang 27/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 09845d2..f4d0bca 100644 --- a/src/libb64/cdecode.c +++ b/src/libb64/cdecode.c @@ -1,8 +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 STM32F/L/H/G/WB/MP1 with built-in Ethernet LAN8742A (Nucleo-144, DISCOVERY, etc) or W5x00/ENC28J60 shield/module @@ -15,7 +12,7 @@ Licensed under MIT license - Version: 1.4.0 + Version: 1.4.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -28,23 +25,27 @@ 1.3.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7 1.3.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.4.0 K Hoang 25/12/2021 Reduce usage of Arduino String with std::string. Fix bug - *************************************************************************************************************************************/ + 1.4.1 K Hoang 27/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[] = + { 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); + value_in -= 43; + + if (value_in < 0 || value_in > decoding_size) + return -1; - int newValue = (int) value_in - 43; - //value_in -= 43; - if (newValue < 0 || newValue > decoding_size) return -1; - return decoding[newValue]; + return decoding[(int)value_in]; } void base64_init_decodestate(base64_decodestate* state_in) @@ -53,13 +54,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; @@ -77,13 +76,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 { @@ -94,14 +91,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 { @@ -112,14 +107,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 { @@ -130,22 +123,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 6a4200a..9ababdb 100644 --- a/src/libb64/cdecode.h +++ b/src/libb64/cdecode.h @@ -1,8 +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 STM32F/L/H/G/WB/MP1 with built-in Ethernet LAN8742A (Nucleo-144, DISCOVERY, etc) or W5x00/ENC28J60 shield/module @@ -15,7 +12,7 @@ Licensed under MIT license - Version: 1.4.0 + Version: 1.4.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -28,7 +25,8 @@ 1.3.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7 1.3.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.4.0 K Hoang 25/12/2021 Reduce usage of Arduino String with std::string. Fix bug - *************************************************************************************************************************************/ + 1.4.1 K Hoang 27/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 + *****************************************************************************************************************************/ #pragma once @@ -67,3 +65,4 @@ int base64_decode_chars(const char* code_in, const int length_in, char* plaintex #endif #endif /* BASE64_CDECODE_H */ + diff --git a/src/libb64/cencode.c b/src/libb64/cencode.c index 89a6149..208e408 100644 --- a/src/libb64/cencode.c +++ b/src/libb64/cencode.c @@ -1,8 +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 STM32F/L/H/G/WB/MP1 with built-in Ethernet LAN8742A (Nucleo-144, DISCOVERY, etc) or W5x00/ENC28J60 shield/module @@ -15,7 +12,7 @@ Licensed under MIT license - Version: 1.4.0 + Version: 1.4.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -28,8 +25,9 @@ 1.3.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7 1.3.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.4.0 K Hoang 25/12/2021 Reduce usage of Arduino String with std::string. Fix bug - *************************************************************************************************************************************/ - + 1.4.1 K Hoang 27/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 + *****************************************************************************************************************************/ + #include "cencode.h" const int CHARS_PER_LINE = 72; @@ -56,8 +54,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; @@ -66,7 +64,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; @@ -79,10 +76,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; @@ -95,10 +89,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; @@ -119,8 +110,6 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out, *codechar++ = '\n'; state_in->stepcount = 0; } - - break; } } @@ -158,5 +147,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 cd0d539..ce352f7 100644 --- a/src/libb64/cencode.h +++ b/src/libb64/cencode.h @@ -1,8 +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 STM32F/L/H/G/WB/MP1 with built-in Ethernet LAN8742A (Nucleo-144, DISCOVERY, etc) or W5x00/ENC28J60 shield/module @@ -15,7 +12,7 @@ Licensed under MIT license - Version: 1.4.0 + Version: 1.4.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -28,7 +25,8 @@ 1.3.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7 1.3.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.4.0 K Hoang 25/12/2021 Reduce usage of Arduino String with std::string. Fix bug - *************************************************************************************************************************************/ + 1.4.1 K Hoang 27/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 + *****************************************************************************************************************************/ #pragma once @@ -70,3 +68,4 @@ int base64_encode_chars(const char* plaintext_in, int length_in, char* code_out) #endif #endif /* BASE64_CENCODE_H */ + diff --git a/src/time_macros.h b/src/time_macros.h index 2d68e3e..89451ec 100644 --- a/src/time_macros.h +++ b/src/time_macros.h @@ -12,7 +12,7 @@ Licensed under MIT license - Version: 1.4.0 + Version: 1.4.1 Version Modified By Date Comments ------- ----------- ---------- ----------- @@ -25,6 +25,7 @@ 1.3.0 K Hoang 11/04/2021 Add support to LAN8720 using STM32F4 or STM32F7 1.3.1 K Hoang 04/10/2021 Change option for PIO `lib_compat_mode` from default `soft` to `strict`. Update Packages Patches 1.4.0 K Hoang 25/12/2021 Reduce usage of Arduino String with std::string. Fix bug + 1.4.1 K Hoang 27/12/2021 Fix wrong http status header bug and authenticate issue caused by libb64 *************************************************************************************************************************************/ #include "SSLClient/time_macros.h"