diff --git a/CHANGELOG b/CHANGELOG index c9178e79a..072550e09 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,10 +1,161 @@ This is the changelog file for the POCO C++ Libraries. - -Release 1.9.1 (2018-xx-xx) +Release 1.10.0 (2020-01-xx) ========================== -- TODO +- This release now requires a C++14 compiler (GCC 5, Clang 3.4, Visual C++ 2015). +- POCO's fixed-size integer types are now based on types. This changes + the definition of Poco::Int64 and Poco::UInt64 on some platforms. +- Many methods exposing raw pointers have been changed to use smart pointers + (usually Poco::SharedPtr or Poco::AutoPtr) instead. This may break some existing + code. Specifically, the Logging framework in the Foundation library and the + Configuration framework in the Util library have been changed. +- New JWT library for dealing with JSON Web Tokens. +- Upgrade bundled SQLite to version 3.31.0. +- The NetSSL_OpenSSL library supports TLS 1.3 with OpenSSL 1.1.1 or later. +- The NetSSL_Win library supports TLS 1.3 if it's supported by the underlying SChannel + implementation. +- Added support for NTLM authentication in the Net library. +- NetSSL_OpenSSL now has a Poco::Net::FTPSClientSession and Poco::Net::FTPSStreamOpener + class for connecting to FTP servers over TLS. +- Fixed a potential crash in Poco::Net::NetworkInterface on Linux and macOS due to + an invalid cast when obtaining the MAC address of an interface. +- GH #2624: Poco::FileChannel/Poco:LogFileImpl::writeImpl() on Windows should translate \n to \r\n. +- GH #2869: X509Certificate does not render UTF-8 characters in subjectName +- GH #2863: NetworkInterface::map can fail to reveal some interfaces if an earlier one can not be handled +- GH #2807: Poco::Data::ODBC Binding of SQL Decimal Type +- GH #2812: String trimInPlace crashes with 0 size on Visual Studio Express 2017 +- GH #2830: Fix wrong buffer size in client handshake when re-using a SecureSocket [NetSSL_Win] +- GH #2809: Allow to filter long tests using a command line argument +- GH #2853: Poco::Process::launch process environment unicode support is broken on Windows +- GH #2843: Poco::Net::MediaType::parse() does not split parameters +- GH #2772: On iOS real device (not simulator) the home directory is not usable +- GH #2689: Added tryWait() into Process and ProcessHandle. Handle kill()-ed UNIX process exit codes. +- GH #2866: unescape Backslash char in UTF8 unescape method +- GH #2879: Add support for SameSite attribute in HTTPCookie +- GH #2824: Poco::Environment missing UTF8/wstring support on Windows +- GH #2295: setEscapeUnicode() functions in JSON Array and Object classes ignore their boolean parameter +- GH #2306: Why does Poco explicitly define _WIN32_WINNT? +- GH #2802: Deprecated warning when building POCO with OpenSSL in submodule + cmake +- GH #2884: Is it a description error about setReceiveTimeout()? +- GH #2780: Allow Poco::Net::Context::usePrivateKey to accept ECKey and/or general EVPPKey +- GH #2747: NetSSL_Win: Context constructor usage argument should specify minimum supported SSL/TLS version +- GH #2745: Small problem in the code +- GH #2743: X509Certificate validFrom expiresOn Date parsing +- GH #2744: Poco::Mysql does not build with MySQL 8.0+ +- GH #2686: Uploads larger than 2GB fail +- GH #2217: UUIDGenerator should allow random seed +- GH #1609: Improve XDG Base Directory Specification implementation +- GH #561: Support for XDG Base Directory Specification +- GH #2881: Add an option to force the use of PollingDirectoryWatcherStrategy +- GH #2584: Adding standard macOS legacy encodings +- GH #2885: fix Dynamic::Var parse string issue +- GH #2616: Restore pre-1.8.0 behaviour of Poco::Net::ServerSocket::bind. +- GH #2641: Implement DataURIStream for extracting data from data URIs. +- GH #2842: File fail on overwrite +- GH #2840: Deleting Registry Keys on the WOW6432Node is not possible on 64Bit Applications +- GH #2841: Service manager improvments +- GH #2827: X509Certificate: Get rid of deprecated OpenSSL 1.1 APIs +- GH #2826: CipherImpl: Fix small error with OpenSSL 1.1 +- GH #2775: Fix issue in NetSSL_Win. Windows Server 2016 reboots while trying to establish an SSL connection. +- GH #2773: Fix the issue with incorrect type of store name parameter in CertOpenStore API call into NetSSL_Win +- GH #2766: Support qnx sdp7 +- GH #2308: SocketAcceptor::setReactor() is broken +- GH #2250: Poco::strToInt<> fails for values right above the type's boundary / limit +- GH #2249: Poco::JSON::Object::set() should return reference to this to allow chaining. +- GH #2275: SQLite mismatch open/close API calls +- GH #1921: ICMPSocket does not check reply address +- GH #2092: Use PollSet in SocketReactor +- GH #2552: Poco::MongoDB test cases failed in Linux on IBM z +- GH #2546: MySQL session state is not cleared in SessionPool +- GH #2410: Preserve entries order in DynamicStruct +- GH #2467: Can not open certain zip files include data descriptor +- GH #2398: Poco 1.9.1 branch cmake build on FreeBSD 11.1 failed +- GH #2365: add struct tm support to DateTime +- GH #2348: NTPClient not checking reply address +- GH #2346: lock-order-inversion in SocketReactor +- GH #2330: add socket gather/scatter capabilities +- GH #2343: UDPServer and client +- GH #2329: add PMTU discovery +- GH #2345: SocketNotifier not thread-safe +- GH #2323: WebSocketTest.cpp faults reported by valgrind +- GH #1160: Poco::Net::NetException "SSL Exception: error:1409F07F:SSL routines:ssl3_write_pending:bad write retry" +- GH #2547: Reset connection when a session is returned to the SessionPool +- GH #2451: http client timeout on Windows 7 and Server 2008 R2 +- GH #2417: Added missing IPv6 methods to SecureSocketImpl +- GH #2408: add ordered containers +- GH #2042: Android abstract namespace local socket address +- GH #2088: Fix race condition in TCPServerDispatcher.cpp + + +Release 1.9.4 (2019-09-18) +========================== + +- fixed GH #2784: Upgrade bundled expat XML parser library to release 2.2.8, + which fixes CVE-2019-15903. + + +Release 1.9.3 (2019-08-20) +========================== + +- fixed GH #2603: Remove incorrect upper size limits for SSL certificates in NetSSL_Win +- fixed GH #2661: Poco::Zip::ZipArchive cannot load new tomcat.zip file (additional fix) +- fixed GH #2742: Support of vs150 & vs160 with the official Microsoft localization executable, + vswhere.exe, installed by MSVC starting from VS2017 +- Data/ODBC: make binding of std::string configurable (SQL_LONGVARCHAR - default or SQL_VARCHAR) + through a global setting (Poco::Data::ODBC::Connector::bindStringToLongVarChar()). +- added Poco::SharedLibrary::setSearchPath() (currently implemented on Windows only) +- Windows required minimum version is now Windows XP SP2 +- upgraded bundled SQLite to 3.29.0 +- CppParser now supports type aliases defined with using keyword. +- PageCompiler: added support for adding Content-Security-Policy and Cache-Control headers. + + +Release 1.9.2 (2019-07-02) +========================== + +- fixed GH #2736: Error using CMake gui - latest version +- fixed GH #2737: Bundles vulnerable copy of Expat — please upgrade to Expat 2.2.7 +- fixed GH #2738: Poco::AccessExpireStrategy::onGet() must not extend expiration time after expiration + + +Release 1.9.1 (2019-06-24) +========================== + +- Added support for building with different OpenSSL distributions on Windows. + See the POCO_EXTERNAL_OPENSSL macro defined in Foundation/include/Poco/Config.h + for options. +- Added Poco::Net::HTTPClientSession::flushRequest() +- Added Poco::Net::WebSocket::setMaxPayloadSize() and Poco::Net::WebSocket::getMaxPayloadSize() + to specify a maximum acceptable payload size for Poco::Net::WebSocket::receiveFrame(). +- Poco::Net::WebSocket: don't attempt to send empty credentials in response to 401 response. +- Redis: added support for additional commands (exists, expire, ping, multi, exec, discard) +- Redis: added Poco::Redis::Client::isConnected() +- Upgraded bundled PCRE to version 8.43 +- Upgraded bundled SQLite to version 3.28.0 +- Added project/solution files for Visual Studio 2019 +- Fixed Visual Studio project files (version information from DLLVersion.rc not included in DLLs) +- Include version resource in DLLs built with CMake +- Added HTTP*Credentials::empty() and HTTPCredentials::clear() +- fixed GH #2220: Encoding/DoubleByteEncoding.cpp fails to compile with VS2008 and _DEBUG +- fixed GH #2243: DLLVersion.rc is excluded from build, missing detail information in properties of *.dll +- fixed GH #2277: SQLite null pointer dereference occurs when exception is being thrown +- fixed GH #2313: PollSet behaves differently on windows +- fixed GH #2316: cmake can't find MySQL and ODBC libraries +- fixed GH #2336: Omit ContentLength in WebSocket accept response +- fixed GH #2358: Don't include for later OpenSSL +- fixed GH #2364: Stringify escapes every unicode symbol when object contain an array +- fixed GH #2380: Calling Poco::Net::X509Certificate::addChainCertificate() leads to double free. +- fixed GH #2492: Net::Socket::address() crash on Android +- fixed GH #2549: Fix keepAlive in http client session +- fixed GH #2565: HTMLForm: optional enforcement of Content-Length instead of Chunked Transfer-Encoding +- fixed GH #2570: DialogSocket: receiveStatusMessage() - line length limit applies to entire multi-line message +- fixed GH #2583: Crypto library does not build with OpenSSL 1.0.0 +- fixed GH #2655: MongoDB Binary element to string - bug +- fixed GH #2661: Poco::Zip::ZipArchive cannot load new tomcat.zip file +- fixed GH #2700: Invalid read of memory in Poco::Environment::set which may cause crashes. +- fixed GH #2712: File_WIN32.cpp(168): error C2065: "_upath":Undeclared identifier +- fixed GH #2723: Access violation when trying to decompress .zip file with unsupported compression method. Release 1.9.0 (2018-03-07) @@ -33,7 +184,6 @@ Release 1.9.0 (2018-03-07) - fixed GH #2199 and GH #2188: Illegal header in zip file exception/assertion failure during JAR file decompression - fixed GH #2203: Use MAX_ADDRESS_LENGTH to determine buffer size - Release 1.8.1 (2018-01-09) ========================== diff --git a/Crypto/src/X509Certificate.cpp b/Crypto/src/X509Certificate.cpp index b4276ee26..09a251d7b 100644 --- a/Crypto/src/X509Certificate.cpp +++ b/Crypto/src/X509Certificate.cpp @@ -40,6 +40,7 @@ namespace Poco { namespace Crypto { + X509Certificate::X509Certificate(std::istream& istr): _pCert(0) { diff --git a/Encodings/Encodings_vs140.vcxproj b/Encodings/Encodings_vs140.vcxproj index 139f706c5..52d34aa1f 100644 --- a/Encodings/Encodings_vs140.vcxproj +++ b/Encodings/Encodings_vs140.vcxproj @@ -555,6 +555,13 @@ + + + + + + + @@ -610,6 +617,27 @@ true + + true + + + true + + + true + + + true + + + true + + + true + + + true + true diff --git a/Encodings/Encodings_vs140.vcxproj.filters b/Encodings/Encodings_vs140.vcxproj.filters index 071064d2b..da98e80fd 100644 --- a/Encodings/Encodings_vs140.vcxproj.filters +++ b/Encodings/Encodings_vs140.vcxproj.filters @@ -2,13 +2,13 @@ - {58b191ff-154a-4063-ad01-b07863dd1cc5} + {2ac0c7b3-1706-4a76-895c-f3d4d3867af6} - {dcda7a77-ed5e-4a20-ade1-10854f25a93e} + {8e7ce3c1-f21d-42d1-9963-13ccbad20fb9} - {014c6981-a0a7-4866-a4c5-aa31aeba6ed1} + {2d656b8f-d362-4626-9ffb-7c9ee3bf0d7c} @@ -54,6 +54,27 @@ Encodings\Header Files + + Encodings\Header Files + + + Encodings\Header Files + + + Encodings\Header Files + + + Encodings\Header Files + + + Encodings\Header Files + + + Encodings\Header Files + + + Encodings\Header Files + Encodings\Header Files @@ -131,6 +152,27 @@ Encodings\Source Files + + Encodings\Source Files + + + Encodings\Source Files + + + Encodings\Source Files + + + Encodings\Source Files + + + Encodings\Source Files + + + Encodings\Source Files + + + Encodings\Source Files + Encodings\Source Files diff --git a/Encodings/Encodings_vs150.vcxproj b/Encodings/Encodings_vs150.vcxproj index c37eaea01..1bd627af6 100644 --- a/Encodings/Encodings_vs150.vcxproj +++ b/Encodings/Encodings_vs150.vcxproj @@ -555,6 +555,13 @@ + + + + + + + @@ -610,6 +617,27 @@ true + + true + + + true + + + true + + + true + + + true + + + true + + + true + true diff --git a/Encodings/Encodings_vs150.vcxproj.filters b/Encodings/Encodings_vs150.vcxproj.filters index 9cc732233..756b7c2f4 100644 --- a/Encodings/Encodings_vs150.vcxproj.filters +++ b/Encodings/Encodings_vs150.vcxproj.filters @@ -2,13 +2,13 @@ - {c0d9c3b6-9378-44c7-a21a-929edee5dd7f} + {059be2e2-58fd-4d6e-a62f-54b17f0b1844} - {b9a983be-7c7f-4eec-9dcf-eb7b7b2f86fb} + {273f8676-5623-4cd9-af43-21034e4198ba} - {72afe60a-e118-457c-81bf-0ddb945bc776} + {2dafa9e2-18b7-42e1-acfb-befdc79fad72} @@ -54,6 +54,27 @@ Encodings\Header Files + + Encodings\Header Files + + + Encodings\Header Files + + + Encodings\Header Files + + + Encodings\Header Files + + + Encodings\Header Files + + + Encodings\Header Files + + + Encodings\Header Files + Encodings\Header Files @@ -131,6 +152,27 @@ Encodings\Source Files + + Encodings\Source Files + + + Encodings\Source Files + + + Encodings\Source Files + + + Encodings\Source Files + + + Encodings\Source Files + + + Encodings\Source Files + + + Encodings\Source Files + Encodings\Source Files diff --git a/Encodings/Encodings_vs160.vcxproj b/Encodings/Encodings_vs160.vcxproj index c2ea1924b..8af93886f 100644 --- a/Encodings/Encodings_vs160.vcxproj +++ b/Encodings/Encodings_vs160.vcxproj @@ -555,6 +555,13 @@ + + + + + + + @@ -610,6 +617,27 @@ true + + true + + + true + + + true + + + true + + + true + + + true + + + true + true diff --git a/Encodings/Encodings_vs160.vcxproj.filters b/Encodings/Encodings_vs160.vcxproj.filters index 958c0b469..19648d734 100644 --- a/Encodings/Encodings_vs160.vcxproj.filters +++ b/Encodings/Encodings_vs160.vcxproj.filters @@ -2,13 +2,13 @@ - {771c4676-654f-44d3-a24c-7d31745bcd04} + {55103894-3f7d-468d-8f72-02dfb1f682c4} - {2eee337f-d34c-42e3-8cdd-a82de9eb348e} + {8309e362-b466-4aaf-8e25-bdb584f77382} - {b859645a-894c-49c5-97f2-1d2141dd2922} + {fbc64e7d-d8ff-43a9-86e1-9193e72d9317} @@ -54,6 +54,27 @@ Encodings\Header Files + + Encodings\Header Files + + + Encodings\Header Files + + + Encodings\Header Files + + + Encodings\Header Files + + + Encodings\Header Files + + + Encodings\Header Files + + + Encodings\Header Files + Encodings\Header Files @@ -131,6 +152,27 @@ Encodings\Source Files + + Encodings\Source Files + + + Encodings\Source Files + + + Encodings\Source Files + + + Encodings\Source Files + + + Encodings\Source Files + + + Encodings\Source Files + + + Encodings\Source Files + Encodings\Source Files diff --git a/Encodings/Encodings_vs90.vcproj b/Encodings/Encodings_vs90.vcproj index 941c5e597..98cdf3cb1 100644 --- a/Encodings/Encodings_vs90.vcproj +++ b/Encodings/Encodings_vs90.vcproj @@ -556,6 +556,34 @@ RelativePath=".\include\Poco\ISO8859_9Encoding.h" > + + + + + + + + + + + + + + @@ -660,6 +688,34 @@ RelativePath=".\src\ISO8859_9Encoding.cpp" > + + + + + + + + + + + + + + @@ -709,20 +765,6 @@ - - - - - - + + @@ -1595,6 +1597,8 @@ + + diff --git a/Foundation/Foundation_vs140.vcxproj.filters b/Foundation/Foundation_vs140.vcxproj.filters index 5fe93b211..63068d883 100644 --- a/Foundation/Foundation_vs140.vcxproj.filters +++ b/Foundation/Foundation_vs140.vcxproj.filters @@ -909,6 +909,12 @@ Crypt\Source Files + + URI\Source Files + + + URI\Source Files + @@ -1865,6 +1871,12 @@ Crypt\Header Files + + URI\Header Files + + + URI\Header Files + diff --git a/Foundation/Foundation_vs150.vcxproj b/Foundation/Foundation_vs150.vcxproj index c81cb45a9..b5865f5fd 100644 --- a/Foundation/Foundation_vs150.vcxproj +++ b/Foundation/Foundation_vs150.vcxproj @@ -603,6 +603,8 @@ + + @@ -1595,6 +1597,8 @@ + + diff --git a/Foundation/Foundation_vs150.vcxproj.filters b/Foundation/Foundation_vs150.vcxproj.filters index 5fe93b211..63068d883 100644 --- a/Foundation/Foundation_vs150.vcxproj.filters +++ b/Foundation/Foundation_vs150.vcxproj.filters @@ -909,6 +909,12 @@ Crypt\Source Files + + URI\Source Files + + + URI\Source Files + @@ -1865,6 +1871,12 @@ Crypt\Header Files + + URI\Header Files + + + URI\Header Files + diff --git a/Foundation/Foundation_vs160.vcxproj b/Foundation/Foundation_vs160.vcxproj index 30e595fc5..c7411be45 100644 --- a/Foundation/Foundation_vs160.vcxproj +++ b/Foundation/Foundation_vs160.vcxproj @@ -603,6 +603,8 @@ + + @@ -1595,6 +1597,8 @@ + + diff --git a/Foundation/Foundation_vs160.vcxproj.filters b/Foundation/Foundation_vs160.vcxproj.filters index 5fe93b211..63068d883 100644 --- a/Foundation/Foundation_vs160.vcxproj.filters +++ b/Foundation/Foundation_vs160.vcxproj.filters @@ -909,6 +909,12 @@ Crypt\Source Files + + URI\Source Files + + + URI\Source Files + @@ -1865,6 +1871,12 @@ Crypt\Header Files + + URI\Header Files + + + URI\Header Files + diff --git a/Foundation/Makefile b/Foundation/Makefile index d9c7af191..23d1243a0 100644 --- a/Foundation/Makefile +++ b/Foundation/Makefile @@ -30,7 +30,7 @@ objects = ArchiveStrategy Ascii ASCIIEncoding AsyncChannel \ FileStreamFactory URIStreamFactory URIStreamOpener UTF32Encoding UTF16Encoding UTF8Encoding UTF8String \ Unicode UnicodeConverter Windows1250Encoding Windows1251Encoding Windows1252Encoding \ UUID UUIDGenerator Void Var VarHolder VarIterator Format Pipe PipeImpl PipeStream SharedMemory \ - MemoryStream FileStream AtomicCounter + MemoryStream FileStream AtomicCounter DataURIStream DataURIStreamFactory zlib_objects = adler32 compress crc32 deflate \ infback inffast inflate inftrees trees zutil diff --git a/Foundation/include/Poco/DataURIStream.h b/Foundation/include/Poco/DataURIStream.h new file mode 100644 index 000000000..154f3fb35 --- /dev/null +++ b/Foundation/include/Poco/DataURIStream.h @@ -0,0 +1,78 @@ +// +// DataURIStream.h +// +// Library: Foundation +// Package: Streams +// Module: DataURIStreamFactory +// +// Definition of the DataURIStream class. +// +// Copyright (c) 2019, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef Foundation_DataURIStream_INCLUDED +#define Foundation_DataURIStream_INCLUDED + + +#include "Poco/Foundation.h" +#include +#include + + +namespace Poco { + + +class Base64Decoder; +class MemoryInputStream; +class URI; + + +class Foundation_API DataURIStreamIOS: public virtual std::ios + /// The base class for DataURIStream. + /// + /// This class is needed to ensure the correct initialization + /// order of the stream buffer and base classes. +{ +public: + DataURIStreamIOS(const URI& uri); + ~DataURIStreamIOS(); + std::streambuf* rdbuf(); + +protected: + std::streambuf* _buf; + +private: + DataURIStreamIOS(const DataURIStreamIOS&); + DataURIStreamIOS& operator = (const DataURIStreamIOS&); + std::string _data; + std::unique_ptr _memoryStream; + std::unique_ptr _base64Decoder; +}; + + +class Foundation_API DataURIStream: public DataURIStreamIOS, public std::istream + /// An input stream for reading data from a data URI. + /// For example, when constructed from "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D" it reads "Hello, World!". +{ +public: + DataURIStream(const URI& uri); + /// Creates a DataURIStream for the given data URI, + /// ready for reading data. + /// Throws a DataFormatException exception if the data is incorrect format. + ~DataURIStream(); + /// Destroys the DataURIStream. + +private: + DataURIStream(const DataURIStream&); + DataURIStream& operator = (const DataURIStream&); +}; + + +} // namespace Poco + + +#endif // Foundation_DataURIStream_INCLUDED diff --git a/Foundation/include/Poco/DataURIStreamFactory.h b/Foundation/include/Poco/DataURIStreamFactory.h new file mode 100644 index 000000000..4c0a83b45 --- /dev/null +++ b/Foundation/include/Poco/DataURIStreamFactory.h @@ -0,0 +1,58 @@ +// +// DataURIStreamFactory.h +// +// Library: Foundation +// Package: URI +// Module: DataURIStreamFactory +// +// Definition of the DataURIStreamFactory class. +// +// Copyright (c) 2019, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef Foundation_DataURIStreamFactory_INCLUDED +#define Foundation_DataURIStreamFactory_INCLUDED + + +#include "Poco/Foundation.h" +#include "Poco/URIStreamFactory.h" + + +namespace Poco { + + +class Foundation_API DataURIStreamFactory: public URIStreamFactory + /// An implementation of the URIStreamFactory interface + /// that read data from data URIs. + /// For example, for URI "data:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D" it read "Hello, World!". +{ +public: + DataURIStreamFactory(); + /// Creates the DataURIStreamFactory. + + ~DataURIStreamFactory(); + /// Destroys the DataURIStreamFactory. + + std::istream* open(const URI& uri); + /// Creates an input stream returning decoded data from the given data URI. + /// + /// Throws a DataFormatException exception if the data is incorrect format. + + static void registerFactory(); + /// Registers the DataURIStreamFactory with the + /// default URIStreamOpener instance. + + static void unregisterFactory(); + /// Unregisters the DataURIStreamFactory with the + /// default URIStreamOpener instance. +}; + + +} // namespace Poco + + +#endif // Foundation_DataURIStreamFactory_INCLUDED diff --git a/Foundation/src/DataURIStream.cpp b/Foundation/src/DataURIStream.cpp new file mode 100644 index 000000000..6167baf77 --- /dev/null +++ b/Foundation/src/DataURIStream.cpp @@ -0,0 +1,72 @@ +// +// DataURIStream.cpp +// +// Library: Foundation +// Package: Streams +// Module: DataURIStreamFactory +// +// Copyright (c) 2019, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/DataURIStream.h" +#include "Poco/Base64Decoder.h" +#include "Poco/Exception.h" +#include "Poco/MemoryStream.h" +#include "Poco/Path.h" +#include "Poco/StreamUtil.h" +#include "Poco/URI.h" +#include + + +namespace Poco { + + +DataURIStreamIOS::DataURIStreamIOS(const URI& uri) +{ + poco_assert (uri.getScheme() == "data"); + + const std::string& path = uri.getPath(); + size_t comma = path.find(','); + if (comma == std::string::npos) + throw DataFormatException(); + _data = path.substr(comma + 1); + _memoryStream.reset(new MemoryInputStream(_data.data(), _data.length())); + constexpr char base64[] = ";base64"; + const size_t base64Len = strlen(base64); + if ((comma >= base64Len) && !path.compare(comma - base64Len, base64Len, base64, base64Len)) + { + _base64Decoder.reset(new Base64Decoder(*_memoryStream, 0)); + _buf = _base64Decoder->rdbuf(); + } + else + _buf = _memoryStream->rdbuf(); + poco_ios_init(_buf); +} + + +DataURIStreamIOS::~DataURIStreamIOS() +{ +} + + +std::streambuf* DataURIStreamIOS::rdbuf() +{ + return _buf; +} + + +DataURIStream::DataURIStream(const URI& uri): DataURIStreamIOS(uri), std::istream(_buf) +{ +} + + +DataURIStream::~DataURIStream() +{ +} + + +} // namespace Poco diff --git a/Foundation/src/DataURIStreamFactory.cpp b/Foundation/src/DataURIStreamFactory.cpp new file mode 100644 index 000000000..37cb0bb3e --- /dev/null +++ b/Foundation/src/DataURIStreamFactory.cpp @@ -0,0 +1,54 @@ +// +// DataURIStreamFactory.cpp +// +// Library: Foundation +// Package: URI +// Module: DataURIStreamFactory +// +// Copyright (c) 2019, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/DataURIStreamFactory.h" +#include "Poco/DataURIStream.h" +#include "Poco/URI.h" +#include "Poco/URIStreamOpener.h" + + +namespace Poco { + + +DataURIStreamFactory::DataURIStreamFactory() +{ +} + + +DataURIStreamFactory::~DataURIStreamFactory() +{ +} + + +std::istream* DataURIStreamFactory::open(const URI& uri) +{ + poco_assert (uri.getScheme() == "data"); + + return new DataURIStream(uri); +} + + +void DataURIStreamFactory::registerFactory() +{ + URIStreamOpener::defaultOpener().registerStreamFactory("data", new DataURIStreamFactory); +} + + +void DataURIStreamFactory::unregisterFactory() +{ + URIStreamOpener::defaultOpener().unregisterStreamFactory("data"); +} + + +} // namespace Poco diff --git a/Foundation/testsuite/Makefile-Driver b/Foundation/testsuite/Makefile-Driver index 46d83251b..a7a7814fa 100644 --- a/Foundation/testsuite/Makefile-Driver +++ b/Foundation/testsuite/Makefile-Driver @@ -37,7 +37,8 @@ objects = ActiveMethodTest ActivityTest ActiveDispatcherTest \ HashSetTest HashMapTest SharedMemoryTest OrderedContainersTest \ UniqueExpireCacheTest UniqueExpireLRUCacheTest UnicodeConverterTest \ TuplesTest NamedTuplesTest TypeListTest VarTest DynamicTestSuite FileStreamTest \ - MemoryStreamTest ObjectPoolTest DirectoryWatcherTest DirectoryIteratorsTest + MemoryStreamTest ObjectPoolTest DirectoryWatcherTest DirectoryIteratorsTest \ + DataURIStreamTest target = testrunner target_version = 1 diff --git a/Foundation/testsuite/TestSuite_vs140.vcxproj b/Foundation/testsuite/TestSuite_vs140.vcxproj index 976d0b3d8..13a6d8757 100644 --- a/Foundation/testsuite/TestSuite_vs140.vcxproj +++ b/Foundation/testsuite/TestSuite_vs140.vcxproj @@ -626,6 +626,7 @@ + @@ -766,6 +767,7 @@ + diff --git a/Foundation/testsuite/TestSuite_vs140.vcxproj.filters b/Foundation/testsuite/TestSuite_vs140.vcxproj.filters index f44c1ae32..66a9a3775 100644 --- a/Foundation/testsuite/TestSuite_vs140.vcxproj.filters +++ b/Foundation/testsuite/TestSuite_vs140.vcxproj.filters @@ -594,6 +594,9 @@ Crypt\Source Files + + URI\Source Files + @@ -1010,5 +1013,8 @@ Crypt\Header Files + + URI\Header Files + \ No newline at end of file diff --git a/Foundation/testsuite/TestSuite_vs150.vcxproj b/Foundation/testsuite/TestSuite_vs150.vcxproj index f52176625..5c851afd0 100644 --- a/Foundation/testsuite/TestSuite_vs150.vcxproj +++ b/Foundation/testsuite/TestSuite_vs150.vcxproj @@ -626,6 +626,7 @@ + @@ -766,6 +767,7 @@ + diff --git a/Foundation/testsuite/TestSuite_vs150.vcxproj.filters b/Foundation/testsuite/TestSuite_vs150.vcxproj.filters index 03217d23a..d29bf4ce4 100644 --- a/Foundation/testsuite/TestSuite_vs150.vcxproj.filters +++ b/Foundation/testsuite/TestSuite_vs150.vcxproj.filters @@ -594,6 +594,9 @@ Crypt\Source Files + + URI\Source Files + @@ -1010,5 +1013,8 @@ Crypt\Header Files + + URI\Header Files + \ No newline at end of file diff --git a/Foundation/testsuite/TestSuite_vs160.vcxproj b/Foundation/testsuite/TestSuite_vs160.vcxproj index 4ce297a7c..2a83a67c2 100644 --- a/Foundation/testsuite/TestSuite_vs160.vcxproj +++ b/Foundation/testsuite/TestSuite_vs160.vcxproj @@ -626,6 +626,7 @@ + @@ -766,6 +767,7 @@ + diff --git a/Foundation/testsuite/TestSuite_vs160.vcxproj.filters b/Foundation/testsuite/TestSuite_vs160.vcxproj.filters index 80872eee3..e2946e043 100644 --- a/Foundation/testsuite/TestSuite_vs160.vcxproj.filters +++ b/Foundation/testsuite/TestSuite_vs160.vcxproj.filters @@ -594,6 +594,9 @@ Crypt\Source Files + + URI\Source Files + @@ -1010,5 +1013,8 @@ Crypt\Header Files + + URI\Header Files + \ No newline at end of file diff --git a/Foundation/testsuite/src/DataURIStreamTest.cpp b/Foundation/testsuite/src/DataURIStreamTest.cpp new file mode 100644 index 000000000..db91833dd --- /dev/null +++ b/Foundation/testsuite/src/DataURIStreamTest.cpp @@ -0,0 +1,113 @@ +// +// DataURIStreamTest.cpp +// +// Copyright (c) 2019, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "DataURIStreamTest.h" +#include "Poco/CppUnit/TestCaller.h" +#include "Poco/CppUnit/TestSuite.h" +#include "Poco/DataURIStream.h" +#include "Poco/Exception.h" +#include "Poco/URI.h" +#include "Poco/StreamCopier.h" +#include + + +using Poco::DataFormatException; +using Poco::DataURIStream; +using Poco::StreamCopier; +using Poco::URI; + + +DataURIStreamTest::DataURIStreamTest(const std::string& name): CppUnit::TestCase(name) +{ +} + + +DataURIStreamTest::~DataURIStreamTest() +{ +} + + +void DataURIStreamTest::testWithBase64() +{ + { + DataURIStream ds(URI("data:;base64,SGVsbG8sIFdvcmxkIQ%3D%3D")); + std::ostringstream ostr; + StreamCopier::copyStream(ds, ostr); + assertTrue (ostr.str() == "Hello, World!"); + } + { + DataURIStream ds(URI("data:text/vnd-example+xyz;foo=bar;base64,R0lGODdh")); + std::ostringstream ostr; + StreamCopier::copyStream(ds, ostr); + assertTrue (ostr.str() == "GIF87a"); + } + { + DataURIStream ds(URI("data:application/octet-stream;base64,A+b/7A==")); + std::ostringstream ostr; + StreamCopier::copyStream(ds, ostr); + assertTrue (ostr.str() == "\x03\xE6\xFF\xEC"); + } +} + + +void DataURIStreamTest::testWithoutBase64() +{ + { + DataURIStream ds(URI("data:,Hello%2C%20World!")); + std::ostringstream ostr; + StreamCopier::copyStream(ds, ostr); + assertTrue (ostr.str() == "Hello, World!"); + } + { + DataURIStream ds(URI("data:text/plain;charset=UTF-8;page=21,the%20data:1234,5678")); + std::ostringstream ostr; + StreamCopier::copyStream(ds, ostr); + assertTrue (ostr.str() == "the data:1234,5678"); + } +} + + +void DataURIStreamTest::testZeroLengthData() +{ + { + DataURIStream ds(URI("data:text/plain;base64,")); + std::ostringstream ostr; + StreamCopier::copyStream(ds, ostr); + assertTrue (ostr.str().empty()); + } + { + DataURIStream ds(URI("data:,")); + std::ostringstream ostr; + StreamCopier::copyStream(ds, ostr); + assertTrue (ostr.str().empty()); + } +} + + +void DataURIStreamTest::setUp() +{ +} + + +void DataURIStreamTest::tearDown() +{ +} + + +CppUnit::Test* DataURIStreamTest::suite() +{ + CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("DataURIStreamTest"); + + CppUnit_addTest(pSuite, DataURIStreamTest, testWithBase64); + CppUnit_addTest(pSuite, DataURIStreamTest, testWithoutBase64); + CppUnit_addTest(pSuite, DataURIStreamTest, testZeroLengthData); + + return pSuite; +} diff --git a/Foundation/testsuite/src/DataURIStreamTest.h b/Foundation/testsuite/src/DataURIStreamTest.h new file mode 100644 index 000000000..6ad680868 --- /dev/null +++ b/Foundation/testsuite/src/DataURIStreamTest.h @@ -0,0 +1,37 @@ +// +// DataURIStreamTest.h +// +// Definition of the DataURItreamTest class. +// +// Copyright (c) 2019, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef DataURIStreamTest_INCLUDED +#define DataURIStreamTest_INCLUDED + + +#include "Poco/CppUnit/TestCase.h" + + +class DataURIStreamTest: public CppUnit::TestCase +{ +public: + DataURIStreamTest(const std::string& name); + ~DataURIStreamTest(); + + void testWithBase64(); + void testWithoutBase64(); + void testZeroLengthData(); + + void setUp(); + void tearDown(); + + static CppUnit::Test* suite(); +}; + + +#endif // DataURIStreamTest_INCLUDED diff --git a/Foundation/testsuite/src/StreamsTestSuite.cpp b/Foundation/testsuite/src/StreamsTestSuite.cpp index 2a8e4b84c..82d39b0b1 100644 --- a/Foundation/testsuite/src/StreamsTestSuite.cpp +++ b/Foundation/testsuite/src/StreamsTestSuite.cpp @@ -23,6 +23,7 @@ #include "FileStreamTest.h" #include "MemoryStreamTest.h" #include "FIFOBufferStreamTest.h" +#include "DataURIStreamTest.h" CppUnit::Test* StreamsTestSuite::suite() @@ -43,6 +44,7 @@ CppUnit::Test* StreamsTestSuite::suite() pSuite->addTest(FileStreamTest::suite()); pSuite->addTest(MemoryStreamTest::suite()); pSuite->addTest(FIFOBufferStreamTest::suite()); + pSuite->addTest(DataURIStreamTest::suite()); return pSuite; } diff --git a/doc/99100-ReleaseNotes.page b/doc/99100-ReleaseNotes.page index 6bc6c8d92..8c8234104 100644 --- a/doc/99100-ReleaseNotes.page +++ b/doc/99100-ReleaseNotes.page @@ -1,11 +1,177 @@ POCO C++ Libraries Release Notes AAAIntroduction +!!!Release 1.10.0 + +!!Summary of Changes + + - This release now requires a C++14 compiler (GCC 5, Clang 3.4, Visual C++ 2015). + - POCO's fixed-size integer types are now based on types. This changes + the definition of Poco::Int64 and Poco::UInt64 on some platforms. + - Many methods exposing raw pointers have been changed to use smart pointers + (usually Poco::SharedPtr or Poco::AutoPtr) instead. This may break some existing + code. Specifically, the Logging framework in the Foundation library and the + Configuration framework in the Util library have been changed. + - New JWT library for dealing with JSON Web Tokens. + - Upgrade bundled SQLite to version 3.31.0. + - The NetSSL_OpenSSL library supports TLS 1.3 with OpenSSL 1.1.1 or later. + - The NetSSL_Win library supports TLS 1.3 if it's supported by the underlying SChannel + implementation. + - Added support for NTLM authentication in the Net library. + - NetSSL_OpenSSL now has a Poco::Net::FTPSClientSession and Poco::Net::FTPSStreamOpener + class for connecting to FTP servers over TLS. + - Fixed a potential crash in Poco::Net::NetworkInterface on Linux and macOS due to + an invalid cast when obtaining the MAC address of an interface. + - GH #2624: Poco::FileChannel/Poco:LogFileImpl::writeImpl() on Windows should translate \n to \r\n. + - GH #2869: X509Certificate does not render UTF-8 characters in subjectName + - GH #2863: NetworkInterface::map can fail to reveal some interfaces if an earlier one can not be handled + - GH #2807: Poco::Data::ODBC Binding of SQL Decimal Type + - GH #2812: String trimInPlace crashes with 0 size on Visual Studio Express 2017 + - GH #2830: Fix wrong buffer size in client handshake when re-using a SecureSocket [NetSSL_Win] + - GH #2809: Allow to filter long tests using a command line argument + - GH #2853: Poco::Process::launch process environment unicode support is broken on Windows + - GH #2843: Poco::Net::MediaType::parse() does not split parameters + - GH #2772: On iOS real device (not simulator) the home directory is not usable + - GH #2689: Added tryWait() into Process and ProcessHandle. Handle kill()-ed UNIX process exit codes. + - GH #2866: unescape Backslash char in UTF8 unescape method + - GH #2879: Add support for SameSite attribute in HTTPCookie + - GH #2824: Poco::Environment missing UTF8/wstring support on Windows + - GH #2295: setEscapeUnicode() functions in JSON Array and Object classes ignore their boolean parameter + - GH #2306: Why does Poco explicitly define _WIN32_WINNT? + - GH #2802: Deprecated warning when building POCO with OpenSSL in submodule + cmake + - GH #2884: Is it a description error about setReceiveTimeout()? + - GH #2780: Allow Poco::Net::Context::usePrivateKey to accept ECKey and/or general EVPPKey + - GH #2747: NetSSL_Win: Context constructor usage argument should specify minimum supported SSL/TLS version + - GH #2745: Small problem in the code + - GH #2743: X509Certificate validFrom expiresOn Date parsing + - GH #2744: Poco::Mysql does not build with MySQL 8.0+ + - GH #2686: Uploads larger than 2GB fail + - GH #2217: UUIDGenerator should allow random seed + - GH #1609: Improve XDG Base Directory Specification implementation + - GH #561: Support for XDG Base Directory Specification + - GH #2881: Add an option to force the use of PollingDirectoryWatcherStrategy + - GH #2584: Adding standard macOS legacy encodings + - GH #2885: fix Dynamic::Var parse string issue + - GH #2616: Restore pre-1.8.0 behaviour of Poco::Net::ServerSocket::bind. + - GH #2641: Implement DataURIStream for extracting data from data URIs. + - GH #2842: File fail on overwrite + - GH #2840: Deleting Registry Keys on the WOW6432Node is not possible on 64Bit Applications + - GH #2841: Service manager improvments + - GH #2827: X509Certificate: Get rid of deprecated OpenSSL 1.1 APIs + - GH #2826: CipherImpl: Fix small error with OpenSSL 1.1 + - GH #2775: Fix issue in NetSSL_Win. Windows Server 2016 reboots while trying to establish an SSL connection. + - GH #2773: Fix the issue with incorrect type of store name parameter in CertOpenStore API call into NetSSL_Win + - GH #2766: Support qnx sdp7 + - GH #2308: SocketAcceptor::setReactor() is broken + - GH #2250: Poco::strToInt<> fails for values right above the type's boundary / limit + - GH #2249: Poco::JSON::Object::set() should return reference to this to allow chaining. + - GH #2275: SQLite mismatch open/close API calls + - GH #1921: ICMPSocket does not check reply address + - GH #2092: Use PollSet in SocketReactor + - GH #2552: Poco::MongoDB test cases failed in Linux on IBM z + - GH #2546: MySQL session state is not cleared in SessionPool + - GH #2410: Preserve entries order in DynamicStruct + - GH #2467: Can not open certain zip files include data descriptor + - GH #2398: Poco 1.9.1 branch cmake build on FreeBSD 11.1 failed + - GH #2365: add struct tm support to DateTime + - GH #2348: NTPClient not checking reply address + - GH #2346: lock-order-inversion in SocketReactor + - GH #2330: add socket gather/scatter capabilities + - GH #2343: UDPServer and client + - GH #2329: add PMTU discovery + - GH #2345: SocketNotifier not thread-safe + - GH #2323: WebSocketTest.cpp faults reported by valgrind + - GH #1160: Poco::Net::NetException "SSL Exception: error:1409F07F:SSL routines:ssl3_write_pending:bad write retry" + - GH #2547: Reset connection when a session is returned to the SessionPool + - GH #2451: http client timeout on Windows 7 and Server 2008 R2 + - GH #2417: Added missing IPv6 methods to SecureSocketImpl + - GH #2408: add ordered containers + - GH #2042: Android abstract namespace local socket address + - GH #2088: Fix race condition in TCPServerDispatcher.cpp + +!!Incompatible Changes and Possible Transition Issues + + - This release now requires a C++14 compiler (GCC 5, Clang 3.4, Visual C++ 2015). + - POCO's fixed-size integer types are now based on types. This changes + the definition of Poco::Int64 and Poco::UInt64 on some platforms. + - Many methods exposing raw pointers have been changed to use smart pointers + (usually Poco::SharedPtr or Poco::AutoPtr) instead. This may break some existing + code. Specifically, the Logging framework in the Foundation library and the + Configuration framework in the Util library have been changed. + + +!!!Release 1.9.4 + +!!Summary of Changes + + - fixed GH #2784: Upgrade bundled expat XML parser library to release 2.2.8, + which fixes CVE-2019-15903. + + +!!!Release 1.9.3 + +!!Summary of Changes + + - fixed GH #2603: Remove incorrect upper size limits for SSL certificates in NetSSL_Win + - fixed GH #2661: Poco::Zip::ZipArchive cannot load new tomcat.zip file (additional fix) + - fixed GH #2742: Support of vs150 & vs160 with the official Microsoft localization executable, + vswhere.exe, installed by MSVC starting from VS2017 + - Data/ODBC: make binding of std::string configurable (SQL_LONGVARCHAR - default or SQL_VARCHAR) + through a global setting (Poco::Data::ODBC::Connector::bindStringToLongVarChar()). + - added Poco::SharedLibrary::setSearchPath() (currently implemented on Windows only) + - Windows required minimum version is now Windows XP SP2 + - upgraded bundled SQLite to 3.29.0 + - CppParser now supports type aliases defined with using keyword. + - PageCompiler: added support for adding Content-Security-Policy and Cache-Control headers. + + +!!!Release 1.9.2 + +!!Summary of Changes + + - fixed GH #2736: Error using CMake gui - latest version + - fixed GH #2737: Bundles vulnerable copy of Expat — please upgrade to Expat 2.2.7 + - fixed GH #2738: Poco::AccessExpireStrategy::onGet() must not extend expiration time after expiration + + !!!Release 1.9.1 !!Summary of Changes - - TODO + - Added support for building with different OpenSSL distributions on Windows. + See the POCO_EXTERNAL_OPENSSL macro defined in Foundation/include/Poco/Config.h + for options. + - Added Poco::Net::HTTPClientSession::flushRequest() + - Added Poco::Net::WebSocket::setMaxPayloadSize() and Poco::Net::WebSocket::getMaxPayloadSize() + to specify a maximum acceptable payload size for Poco::Net::WebSocket::receiveFrame(). + - Poco::Net::WebSocket: don't attempt to send empty credentials in response to 401 response. + - Redis: added support for additional commands (exists, expire, ping, multi, exec, discard) + - Redis: added Poco::Redis::Client::isConnected() + - Upgraded bundled PCRE to version 8.43 + - Upgraded bundled SQLite to version 3.28.0 + - Added project/solution files for Visual Studio 2019 + - Fixed Visual Studio project files (version information from DLLVersion.rc not included in DLLs) + - Include version resource in DLLs built with CMake + - Added HTTP*Credentials::empty() and HTTPCredentials::clear() + - fixed GH #2220: Encoding/DoubleByteEncoding.cpp fails to compile with VS2008 and _DEBUG + - fixed GH #2243: DLLVersion.rc is excluded from build, missing detail information in properties of *.dll + - fixed GH #2277: SQLite null pointer dereference occurs when exception is being thrown + - fixed GH #2313: PollSet behaves differently on windows + - fixed GH #2316: cmake can't find MySQL and ODBC libraries + - fixed GH #2336: Omit ContentLength in WebSocket accept response + - fixed GH #2358: Don't include for later OpenSSL + - fixed GH #2364: Stringify escapes every unicode symbol when object contain an array + - fixed GH #2380: Calling Poco::Net::X509Certificate::addChainCertificate() leads to double free. + - fixed GH #2492: Net::Socket::address() crash on Android + - fixed GH #2549: Fix keepAlive in http client session + - fixed GH #2565: HTMLForm: optional enforcement of Content-Length instead of Chunked Transfer-Encoding + - fixed GH #2570: DialogSocket: receiveStatusMessage() - line length limit applies to entire multi-line message + - fixed GH #2583: Crypto library does not build with OpenSSL 1.0.0 + - fixed GH #2655: MongoDB Binary element to string - bug + - fixed GH #2661: Poco::Zip::ZipArchive cannot load new tomcat.zip file + - fixed GH #2700: Invalid read of memory in Poco::Environment::set which may cause crashes. + - fixed GH #2712: File_WIN32.cpp(168): error C2065: “_upath”:Undeclared identifier + - fixed GH #2723: Access violation when trying to decompress .zip file with unsupported compression method. !!!Release 1.9.0