Merge branch 'poco-1.10.1' into devel

This commit is contained in:
Günter Obiltschnig 2020-02-04 12:23:12 +01:00
commit ebc1e16a9f
21 changed files with 571 additions and 318 deletions

View File

@ -1,5 +1,11 @@
This is the changelog file for the POCO C++ Libraries.
Release 1.10.1 (2020-02-xx)
==========================
- TODO
Release 1.10.0 (2020-01-27)
==========================

View File

@ -4,8 +4,8 @@
#include "winres.h"
#define POCO_VERSION 1,10,0,0
#define POCO_VERSION_STR "1.10.0"
#define POCO_VERSION 1,10,1,0
#define POCO_VERSION_STR "1.10.1"
VS_VERSION_INFO VERSIONINFO
FILEVERSION POCO_VERSION

View File

@ -1,6 +1,6 @@
/******************************************************************************
** This file is an amalgamation of many separate C source files from SQLite
** version 3.31.0. By combining all the individual C code files into this
** version 3.31.1. By combining all the individual C code files into this
** single large file, the entire code can be compiled as a single translation
** unit. This allows many compilers to do optimizations that would not be
** possible if the files were compiled separately. Performance improvements
@ -1165,9 +1165,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
#define SQLITE_VERSION "3.31.0"
#define SQLITE_VERSION_NUMBER 3031000
#define SQLITE_SOURCE_ID "2020-01-22 18:38:59 f6affdd41608946fcfcea914ece149038a8b25a62bbe719ed2561c649b86d824"
#define SQLITE_VERSION "3.31.1"
#define SQLITE_VERSION_NUMBER 3031001
#define SQLITE_SOURCE_ID "2020-01-27 19:55:54 3bfa9cc97da10598521b342961df8f5f68c7388fa117345eeb516eaa837bb4d6"
/*
** CAPI3REF: Run-Time Library Version Numbers
@ -56233,30 +56233,48 @@ SQLITE_PRIVATE int sqlite3PagerOpen(
** Database file handle (pVfs->szOsFile bytes)
** Sub-journal file handle (journalFileSize bytes)
** Main journal file handle (journalFileSize bytes)
** \0\1\0 journal prefix (3 bytes)
** Journal filename (nPathname+8+1 bytes)
** \2\0 WAL prefix (2 bytes)
** WAL filename (nPathname+4+1 bytes)
** \3\0 database prefix (2 bytes)
** \0\0\0\0 database prefix (4 bytes)
** Database file name (nPathname+1 bytes)
** URI query parameters (nUriByte bytes)
** \0\0 terminator (2 bytes)
** Journal filename (nPathname+8+1 bytes)
** WAL filename (nPathname+4+1 bytes)
** \0\0\0 terminator (3 bytes)
**
** Some 3rd-party software, over which we have no control, depends on
** the specific order of the filenames and the \0 separators between them
** so that it can (for example) find the database filename given the WAL
** filename without using the sqlite3_filename_database() API. This is a
** misuse of SQLite and a bug in the 3rd-party software, but the 3rd-party
** software is in widespread use, so we try to avoid changing the filename
** order and formatting if possible. In particular, the details of the
** filename format expected by 3rd-party software should be as follows:
**
** - Main Database Path
** - \0
** - Multiple URI components consisting of:
** - Key
** - \0
** - Value
** - \0
** - \0
** - Journal Path
** - \0
** - WAL Path (zWALName)
** - \0
*/
pPtr = (u8 *)sqlite3MallocZero(
ROUND8(sizeof(*pPager)) + /* Pager structure */
ROUND8(pcacheSize) + /* PCache object */
ROUND8(pVfs->szOsFile) + /* The main db file */
journalFileSize * 2 + /* The two journal files */
3 + /* Journal prefix */
nPathname + 8 + 1 + /* Journal filename */
#ifndef SQLITE_OMIT_WAL
2 + /* WAL prefix */
nPathname + 4 + 1 + /* WAL filename */
#endif
2 + /* Database prefix */
4 + /* Database prefix */
nPathname + 1 + /* database filename */
nUriByte + /* query parameters */
2 /* Terminator */
nPathname + 8 + 1 + /* Journal filename */
#ifndef SQLITE_OMIT_WAL
nPathname + 4 + 1 + /* WAL filename */
#endif
3 /* Terminator */
);
assert( EIGHT_BYTE_ALIGNMENT(SQLITE_INT_TO_PTR(journalFileSize)) );
if( !pPtr ){
@ -56270,9 +56288,20 @@ SQLITE_PRIVATE int sqlite3PagerOpen(
pPager->jfd = (sqlite3_file*)pPtr; pPtr += journalFileSize;
assert( EIGHT_BYTE_ALIGNMENT(pPager->jfd) );
/* Fill in the Pager.zFilename and pPager.zQueryParam fields */
pPtr += 4; /* Skip zero prefix */
pPager->zFilename = (char*)pPtr;
if( nPathname>0 ){
memcpy(pPtr, zPathname, nPathname); pPtr += nPathname + 1;
if( zUri ){
memcpy(pPtr, zUri, nUriByte); pPtr += nUriByte;
}else{
pPtr++;
}
}
/* Fill in Pager.zJournal */
pPtr[1] = '\001'; pPtr += 3;
if( nPathname>0 ){
pPager->zJournal = (char*)pPtr;
memcpy(pPtr, zPathname, nPathname); pPtr += nPathname;
@ -56283,12 +56312,10 @@ SQLITE_PRIVATE int sqlite3PagerOpen(
#endif
}else{
pPager->zJournal = 0;
pPtr++;
}
#ifndef SQLITE_OMIT_WAL
/* Fill in Pager.zWal */
pPtr[0] = '\002'; pPtr[1] = 0; pPtr += 2;
if( nPathname>0 ){
pPager->zWal = (char*)pPtr;
memcpy(pPtr, zPathname, nPathname); pPtr += nPathname;
@ -56299,21 +56326,9 @@ SQLITE_PRIVATE int sqlite3PagerOpen(
#endif
}else{
pPager->zWal = 0;
pPtr++;
}
#endif
/* Fill in the Pager.zFilename and pPager.zQueryParam fields */
pPtr[0] = '\003'; pPtr[1] = 0; pPtr += 2;
pPager->zFilename = (char*)pPtr;
if( nPathname>0 ){
memcpy(pPtr, zPathname, nPathname); pPtr += nPathname + 1;
if( zUri ){
memcpy(pPtr, zUri, nUriByte); /* pPtr += nUriByte; // not needed */
}
/* Double-zero terminator implied by the sqlite3MallocZero */
}
if( nPathname ) sqlite3DbFree(0, zPathname);
pPager->pVfs = pVfs;
pPager->vfsFlags = vfsFlags;
@ -58433,8 +58448,8 @@ SQLITE_PRIVATE int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint){
** sqlite3_uri_parameter() and sqlite3_filename_database() and friends.
*/
SQLITE_PRIVATE const char *sqlite3PagerFilename(const Pager *pPager, int nullIfMemDb){
static const char zFake[] = { 0x00, 0x01, 0x00, 0x00, 0x00 };
return (nullIfMemDb && pPager->memDb) ? &zFake[3] : pPager->zFilename;
static const char zFake[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
return (nullIfMemDb && pPager->memDb) ? &zFake[4] : pPager->zFilename;
}
/*
@ -117491,6 +117506,9 @@ SQLITE_PRIVATE int sqlite3IsLikeFunction(sqlite3 *db, Expr *pExpr, int *pIsNocas
assert( !ExprHasProperty(pExpr, EP_xIsSelect) );
nExpr = pExpr->x.pList->nExpr;
pDef = sqlite3FindFunction(db, pExpr->u.zToken, nExpr, SQLITE_UTF8, 0);
#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
if( pDef==0 ) return 0;
#endif
if( NEVER(pDef==0) || (pDef->funcFlags & SQLITE_FUNC_LIKE)==0 ){
return 0;
}
@ -122767,11 +122785,11 @@ typedef int (*sqlite3_loadext_entry)(
/* Version 3.26.0 and later */
#define sqlite3_normalized_sql sqlite3_api->normalized_sql
/* Version 3.28.0 and later */
#define sqlite3_stmt_isexplain sqlite3_api->isexplain
#define sqlite3_value_frombind sqlite3_api->frombind
#define sqlite3_stmt_isexplain sqlite3_api->stmt_isexplain
#define sqlite3_value_frombind sqlite3_api->value_frombind
/* Version 3.30.0 and later */
#define sqlite3_drop_modules sqlite3_api->drop_modules
/* Version 3.31.0 andn later */
/* Version 3.31.0 and later */
#define sqlite3_hard_heap_limit64 sqlite3_api->hard_heap_limit64
#define sqlite3_uri_key sqlite3_api->uri_key
#define sqlite3_filename_database sqlite3_api->filename_database
@ -163282,6 +163300,21 @@ SQLITE_API int sqlite3_test_control(int op, ...){
return rc;
}
/*
** The Pager stores the Database filename, Journal filename, and WAL filename
** consecutively in memory, in that order. The database filename is prefixed
** by four zero bytes. Locate the start of the database filename by searching
** backwards for the first byte following four consecutive zero bytes.
**
** This only works if the filename passed in was obtained from the Pager.
*/
static const char *databaseName(const char *zName){
while( zName[-1]!=0 || zName[-2]!=0 || zName[-3]!=0 || zName[-4]!=0 ){
zName--;
}
return zName;
}
/*
** This is a utility routine, useful to VFS implementations, that checks
** to see if a database file was a URI that contained a specific query
@ -163295,6 +163328,7 @@ SQLITE_API int sqlite3_test_control(int op, ...){
*/
SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam){
if( zFilename==0 || zParam==0 ) return 0;
zFilename = databaseName(zFilename);
zFilename += sqlite3Strlen30(zFilename) + 1;
while( zFilename[0] ){
int x = strcmp(zFilename, zParam);
@ -163310,6 +163344,7 @@ SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *
*/
SQLITE_API const char *sqlite3_uri_key(const char *zFilename, int N){
if( zFilename==0 || N<0 ) return 0;
zFilename = databaseName(zFilename);
zFilename += sqlite3Strlen30(zFilename) + 1;
while( zFilename[0] && (N--)>0 ){
zFilename += sqlite3Strlen30(zFilename) + 1;
@ -163343,25 +163378,6 @@ SQLITE_API sqlite3_int64 sqlite3_uri_int64(
return bDflt;
}
/*
** The Pager stores the Journal filename, WAL filename, and Database filename
** consecutively in memory, in that order, with prefixes \000\001\000,
** \002\000, and \003\000, in that order. Thus the three names look like query
** parameters if you start at the first prefix.
**
** This routine backs up a filename to the start of the first prefix.
**
** This only works if the filenamed passed in was obtained from the Pager.
*/
static const char *startOfNameList(const char *zName){
while( zName[0]!='\001' || zName[1]!=0 ){
zName -= 3;
while( zName[0]!='\000' ){ zName--; }
zName++;
}
return zName-1;
}
/*
** Translate a filename that was handed to a VFS routine into the corresponding
** database, journal, or WAL file.
@ -163373,14 +163389,26 @@ static const char *startOfNameList(const char *zName){
** corruption.
*/
SQLITE_API const char *sqlite3_filename_database(const char *zFilename){
return databaseName(zFilename);
return sqlite3_uri_parameter(zFilename - 3, "\003");
}
SQLITE_API const char *sqlite3_filename_journal(const char *zFilename){
const char *z = sqlite3_uri_parameter(startOfNameList(zFilename), "\001");
return ALWAYS(z) && z[0] ? z : 0;
zFilename = databaseName(zFilename);
zFilename += sqlite3Strlen30(zFilename) + 1;
while( zFilename[0] ){
zFilename += sqlite3Strlen30(zFilename) + 1;
zFilename += sqlite3Strlen30(zFilename) + 1;
}
return zFilename + 1;
}
SQLITE_API const char *sqlite3_filename_wal(const char *zFilename){
return sqlite3_uri_parameter(startOfNameList(zFilename), "\002");
#ifdef SQLITE_OMIT_WAL
return 0;
#else
zFilename = sqlite3_filename_journal(zFilename);
zFilename += sqlite3Strlen30(zFilename) + 1;
return zFilename;
#endif
}
/*
@ -219999,8 +220027,8 @@ static int fts5QueryCksum(
** contain valid utf-8, return non-zero.
*/
static int fts5TestUtf8(const char *z, int n){
assert_nc( n>0 );
int i = 0;
assert_nc( n>0 );
while( i<n ){
if( (z[i] & 0x80)==0x00 ){
i++;
@ -223639,7 +223667,7 @@ static void fts5SourceIdFunc(
){
assert( nArg==0 );
UNUSED_PARAM2(nArg, apUnused);
sqlite3_result_text(pCtx, "fts5: 2020-01-22 18:38:59 f6affdd41608946fcfcea914ece149038a8b25a62bbe719ed2561c649b86d824", -1, SQLITE_TRANSIENT);
sqlite3_result_text(pCtx, "fts5: 2020-01-27 19:55:54 3bfa9cc97da10598521b342961df8f5f68c7388fa117345eeb516eaa837bb4d6", -1, SQLITE_TRANSIENT);
}
/*
@ -228412,9 +228440,9 @@ SQLITE_API int sqlite3_stmt_init(
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
/************** End of stmt.c ************************************************/
#if __LINE__!=228415
#if __LINE__!=228443
#undef SQLITE_SOURCE_ID
#define SQLITE_SOURCE_ID "2020-01-22 18:38:59 f6affdd41608946fcfcea914ece149038a8b25a62bbe719ed2561c649b86alt2"
#define SQLITE_SOURCE_ID "2020-01-27 19:55:54 3bfa9cc97da10598521b342961df8f5f68c7388fa117345eeb516eaa837balt2"
#endif
/* Return the source-id for this library */
SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }

View File

@ -123,9 +123,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
#define SQLITE_VERSION "3.31.0"
#define SQLITE_VERSION_NUMBER 3031000
#define SQLITE_SOURCE_ID "2020-01-22 18:38:59 f6affdd41608946fcfcea914ece149038a8b25a62bbe719ed2561c649b86d824"
#define SQLITE_VERSION "3.31.1"
#define SQLITE_VERSION_NUMBER 3031001
#define SQLITE_SOURCE_ID "2020-01-27 19:55:54 3bfa9cc97da10598521b342961df8f5f68c7388fa117345eeb516eaa837bb4d6"
/*
** CAPI3REF: Run-Time Library Version Numbers

View File

@ -82,6 +82,20 @@ public:
/// * highest
///
/// The "priority" property is set-only.
///
/// The "queueSize" property allows to limit the number
/// of messages in the queue. If the queue is full and
/// new messages are logged, these are dropped until the
/// queue has free capacity again. The number of dropped
/// messages is recorded, and a log message indicating the
/// number of dropped messages will be generated when the
/// queue has free capacity again.
/// In addition to an unsigned integer specifying the size,
/// this property can have the values "none" or "unlimited",
/// which disable the queue size limit. A size of 0 also
/// removes the limit.
///
/// The "queueSize" property is set-only.
protected:
~AsyncChannel();
@ -94,6 +108,8 @@ private:
FastMutex _threadMutex;
FastMutex _channelMutex;
NotificationQueue _queue;
std::size_t _queueSize = 0;
std::size_t _dropCount = 0;
};

View File

@ -37,7 +37,7 @@ class Foundation_API LogStreamBuf: public UnbufferedStreamBuf
/// priority.
{
public:
LogStreamBuf(Logger& logger, Message::Priority priority);
LogStreamBuf(Logger& logger, Message::Priority priority, std::size_t bufferCapacity = 0);
/// Creates the LogStream.
~LogStreamBuf();
@ -52,6 +52,12 @@ public:
Logger& logger() const;
/// Returns a reference to the Logger.
std::size_t capacity() const;
/// Returns the internal message buffer capacity.
void reserve(std::size_t capacity);
/// Sets the capacity of the internal message buffer to the given size.
private:
int writeToDevice(char c);
@ -69,7 +75,7 @@ class Foundation_API LogIOS: public virtual std::ios
/// order of the stream buffer and base classes.
{
public:
LogIOS(Logger& logger, Message::Priority priority);
LogIOS(Logger& logger, Message::Priority priority, std::size_t bufferCapacity = 0);
~LogIOS();
LogStreamBuf* rdbuf();
@ -93,10 +99,12 @@ class Foundation_API LogStream: public LogIOS, public std::ostream
/// ls.error() << "Some error message" << std::endl;
{
public:
LogStream(Logger& logger, Message::Priority priority = Message::PRIO_INFORMATION);
static const std::size_t DEFAULT_BUFFER_CAPACITY = 255;
LogStream(Logger& logger, Message::Priority priority = Message::PRIO_INFORMATION, std::size_t bufferCapacity = DEFAULT_BUFFER_CAPACITY);
/// Creates the LogStream, using the given logger and priority.
LogStream(const std::string& loggerName, Message::Priority priority = Message::PRIO_INFORMATION);
LogStream(const std::string& loggerName, Message::Priority priority = Message::PRIO_INFORMATION, std::size_t bufferCapacity = DEFAULT_BUFFER_CAPACITY);
/// Creates the LogStream, using the logger identified
/// by loggerName, and sets the priority.
@ -167,6 +175,12 @@ public:
//
// inlines
//
inline std::size_t LogStreamBuf::capacity() const
{
return _message.capacity();
}
inline Message::Priority LogStreamBuf::getPriority() const
{
return _priority;

View File

@ -154,6 +154,12 @@ public:
void setPort(unsigned short port);
/// Sets the port number part of the URI.
unsigned short getSpecifiedPort() const;
/// Returns the port number part of the URI.
///
/// If no explicit port number has been specified,
/// returns 0.
std::string getAuthority() const;
/// Returns the authority part (userInfo, host and port)
/// of the URI.
@ -400,6 +406,12 @@ inline const std::string& URI::getFragment() const
}
inline unsigned short URI::getSpecifiedPort() const
{
return _port;
}
inline void swap(URI& u1, URI& u2)
{
u1.swap(u2);

View File

@ -35,7 +35,7 @@
// Ax: alpha releases
// Bx: beta releases
//
#define POCO_VERSION 0x010A0000
#define POCO_VERSION 0x010A0100
#endif // Foundation_Version_INCLUDED

View File

@ -18,7 +18,10 @@
#include "Poco/Formatter.h"
#include "Poco/AutoPtr.h"
#include "Poco/LoggingRegistry.h"
#include "Poco/NumberParser.h"
#include "Poco/Exception.h"
#include "Poco/String.h"
#include "Poco/Format.h"
namespace Poco {
@ -106,6 +109,18 @@ void AsyncChannel::close()
void AsyncChannel::log(const Message& msg)
{
if (_queueSize != 0 && _queue.size() >= _queueSize)
{
++_dropCount;
return;
}
if (_dropCount != 0)
{
_queue.enqueueNotification(new MessageNotification(Message(msg, Poco::format("Dropped %z messages.", _dropCount))));
_dropCount = 0;
}
open();
_queue.enqueueNotification(new MessageNotification(msg));
@ -115,11 +130,24 @@ void AsyncChannel::log(const Message& msg)
void AsyncChannel::setProperty(const std::string& name, const std::string& value)
{
if (name == "channel")
{
setChannel(LoggingRegistry::defaultRegistry().channelForName(value));
}
else if (name == "priority")
{
setPriority(value);
}
else if (name == "queueSize")
{
if (Poco::icompare(value, "none") == 0 || Poco::icompare(value, "unlimited") == 0 || value.empty())
_queueSize = 0;
else
_queueSize = Poco::NumberParser::parseUnsigned(value);
}
else
{
Channel::setProperty(name, value);
}
}

View File

@ -23,10 +23,11 @@ namespace Poco {
//
LogStreamBuf::LogStreamBuf(Logger& logger, Message::Priority priority):
LogStreamBuf::LogStreamBuf(Logger& logger, Message::Priority priority, std::size_t bufferCapacity):
_logger(logger),
_priority(priority)
{
_message.reserve(bufferCapacity);
}
@ -41,6 +42,12 @@ void LogStreamBuf::setPriority(Message::Priority priority)
}
void LogStreamBuf::reserve(std::size_t capacity)
{
_message.reserve(capacity);
}
int LogStreamBuf::writeToDevice(char c)
{
if (c == '\n' || c == '\r')
@ -62,8 +69,8 @@ int LogStreamBuf::writeToDevice(char c)
//
LogIOS::LogIOS(Logger& logger, Message::Priority priority):
_buf(logger, priority)
LogIOS::LogIOS(Logger& logger, Message::Priority priority, std::size_t bufferCapacity):
_buf(logger, priority, bufferCapacity)
{
poco_ios_init(&_buf);
}
@ -85,15 +92,15 @@ LogStreamBuf* LogIOS::rdbuf()
//
LogStream::LogStream(Logger& logger, Message::Priority priority):
LogIOS(logger, priority),
LogStream::LogStream(Logger& logger, Message::Priority priority, std::size_t bufferCapacity):
LogIOS(logger, priority, bufferCapacity),
std::ostream(&_buf)
{
}
LogStream::LogStream(const std::string& loggerName, Message::Priority priority):
LogIOS(Logger::get(loggerName), priority),
LogStream::LogStream(const std::string& loggerName, Message::Priority priority, std::size_t bufferCapacity):
LogIOS(Logger::get(loggerName), priority, bufferCapacity),
std::ostream(&_buf)
{
}

View File

@ -55,7 +55,6 @@ URI::URI(const std::string& scheme, const std::string& pathEtc):
_port(0)
{
toLowerInPlace(_scheme);
_port = getWellKnownPort();
std::string::const_iterator beg = pathEtc.begin();
std::string::const_iterator end = pathEtc.end();
parsePathEtc(beg, end);
@ -268,8 +267,6 @@ void URI::setScheme(const std::string& scheme)
{
_scheme = scheme;
toLowerInPlace(_scheme);
if (_port == 0)
_port = getWellKnownPort();
}
@ -842,9 +839,9 @@ void URI::parseHostAndPort(std::string::const_iterator& it, const std::string::c
else
throw URISyntaxException("bad or invalid port number", port);
}
else _port = getWellKnownPort();
else _port = 0;
}
else _port = getWellKnownPort();
else _port = 0;
_host = host;
toLowerInPlace(_host);
}

View File

@ -51,11 +51,13 @@ void URITest::testConstruction()
uri.setAuthority("www.appinf.com");
assertTrue (uri.getAuthority() == "www.appinf.com");
assertTrue (uri.getPort() == 80);
assertTrue (uri.getSpecifiedPort() == 0);
uri.setAuthority("user@services.appinf.com:8000");
assertTrue (uri.getUserInfo() == "user");
assertTrue (uri.getHost() == "services.appinf.com");
assertTrue (uri.getPort() == 8000);
assertTrue (uri.getSpecifiedPort() == 8000);
uri.setPath("/index.html");
assertTrue (uri.getPath() == "/index.html");
@ -110,6 +112,7 @@ void URITest::testConstruction()
assertTrue (uri6.getUserInfo() == "user");
assertTrue (uri6.getHost() == "www.appinf.com");
assertTrue (uri6.getPort() == 80);
assertTrue (uri6.getSpecifiedPort() == 80);
assertTrue (uri6.getAuthority() == "user@www.appinf.com");
assertTrue (uri6.getPath() == "/index.html");
@ -118,6 +121,7 @@ void URITest::testConstruction()
assertTrue (uri7.getUserInfo() == "user");
assertTrue (uri7.getHost() == "www.appinf.com");
assertTrue (uri7.getPort() == 80);
assertTrue (uri7.getSpecifiedPort() == 0);
assertTrue (uri7.getAuthority() == "user@www.appinf.com");
assertTrue (uri7.getPath() == "/index.html");
@ -150,6 +154,7 @@ void URITest::testConstruction()
assertTrue (uri10.getUserInfo().empty());
assertTrue (uri10.getHost() == "2001:db8::7");
assertTrue (uri10.getPort() == 389);
assertTrue (uri10.getSpecifiedPort() == 0);
assertTrue (uri10.getAuthority() == "[2001:db8::7]");
assertTrue (uri10.getPathEtc() == "/c=GB?objectClass?one");

View File

@ -429,7 +429,7 @@ std::string FTPClientSession::extractPath(const std::string& response)
if (*it == '"')
{
++it;
if (it == end || (it != end && *it != '"')) break;
if (it == end || *it != '"') break;
}
path += *it++;
}

View File

@ -164,10 +164,28 @@ public:
/// Specifies a file containing Diffie-Hellman parameters.
/// If empty, the default parameters are used.
bool dhUse2048Bits;
/// If set to true, will use 2048-bit MODP Group with 256-bit
/// prime order subgroup (RFC5114) instead of 1024-bit for DH.
std::string ecdhCurve;
/// OpenSSL 1.0.1 and earlier:
/// Specifies the name of the curve to use for ECDH, based
/// on the curve names specified in RFC 4492.
/// Defaults to "prime256v1".
/// OpenSSL 1.0.2 to 1.1.0:
/// Specifies the colon-separated list of curves
/// to be used for ECDH, based on the curve names
/// defined by OpenSSL, such as
/// "X448:X25519:P-521:P-384:P-256"
/// Defaults to the subset supported by the OpenSSL version
/// among the above.
/// OpenSSL 1.1.1 and above:
/// Specifies the colon-separated list of groups
/// (some of which can be curves) to be used for ECDH
/// and other TLSv1.3 ephemeral key negotiation, based
/// on the group names defined by OpenSSL. Defaults to
/// "X448:X25519:ffdhe4096:ffdhe3072:ffdhe2048:ffdhe6144:ffdhe8192:P-521:P-384:P-256"
};
Context(Usage usage, const Params& params);
@ -383,7 +401,7 @@ private:
void init(const Params& params);
/// Initializes the Context with the given parameters.
void initDH(const std::string& dhFile);
void initDH(bool use2048Bits, const std::string& dhFile);
/// Initializes the Context with Diffie-Hellman parameters.
void initECDH(const std::string& curve);

View File

@ -34,7 +34,8 @@ Context::Params::Params():
verificationMode(VERIFY_RELAXED),
verificationDepth(9),
loadDefaultCAs(false),
cipherList("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH")
cipherList("ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"),
dhUse2048Bits(false)
{
}
@ -174,7 +175,7 @@ void Context::init(const Params& params)
SSL_CTX_set_mode(_pSSLContext, SSL_MODE_AUTO_RETRY);
SSL_CTX_set_session_cache_mode(_pSSLContext, SSL_SESS_CACHE_OFF);
initDH(params.dhParamsFile);
initDH(params.dhUse2048Bits, params.dhParamsFile);
initECDH(params.ecdhCurve);
}
catch (...)
@ -421,20 +422,33 @@ void Context::requireMinimumProtocol(Protocols protocol)
{
case PROTO_SSLV2:
throw Poco::InvalidArgumentException("SSLv2 is no longer supported");
case PROTO_SSLV3:
disableProtocols(PROTO_SSLV2);
break;
case PROTO_TLSV1:
disableProtocols(PROTO_SSLV2 | PROTO_SSLV3);
break;
case PROTO_TLSV1_1:
#if defined(SSL_OP_NO_TLSv1_1) && !defined(OPENSSL_NO_TLS1)
disableProtocols(PROTO_SSLV2 | PROTO_SSLV3 | PROTO_TLSV1);
#else
throw Poco::InvalidArgumentException("TLSv1.1 is not supported by the available OpenSSL library");
#endif
break;
case PROTO_TLSV1_2:
#if defined(SSL_OP_NO_TLSv1_2) && !defined(OPENSSL_NO_TLS1)
disableProtocols(PROTO_SSLV2 | PROTO_SSLV3 | PROTO_TLSV1 | PROTO_TLSV1_1);
#else
throw Poco::InvalidArgumentException("TLSv1.2 is not supported by the available OpenSSL library");
#endif
break;
case PROTO_TLSV1_3:
disableProtocols(PROTO_SSLV2 | PROTO_SSLV3 | PROTO_TLSV1 | PROTO_TLSV1_1 | PROTO_TLSV1_2);
throw Poco::InvalidArgumentException("TLSv1.3 is not supported by the available OpenSSL library");
break;
}
#endif
@ -467,6 +481,24 @@ void Context::createSSLContext()
{
case CLIENT_USE:
case TLS_CLIENT_USE:
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
_pSSLContext = SSL_CTX_new(TLS_client_method());
minTLSVersion = TLS1_VERSION;
#else
_pSSLContext = SSL_CTX_new(SSLv23_client_method());
#endif
break;
case SERVER_USE:
case TLS_SERVER_USE:
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
_pSSLContext = SSL_CTX_new(TLS_server_method());
minTLSVersion = TLS1_VERSION;
#else
_pSSLContext = SSL_CTX_new(SSLv23_server_method());
#endif
break;
case TLSV1_CLIENT_USE:
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
_pSSLContext = SSL_CTX_new(TLS_client_method());
@ -476,8 +508,6 @@ void Context::createSSLContext()
#endif
break;
case SERVER_USE:
case TLS_SERVER_USE:
case TLSV1_SERVER_USE:
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
_pSSLContext = SSL_CTX_new(TLS_server_method());
@ -576,20 +606,9 @@ void Context::createSSLContext()
}
void Context::initDH(const std::string& dhParamsFile)
void Context::initDH(bool use2048Bits, const std::string& dhParamsFile)
{
#ifndef OPENSSL_NO_DH
// 1024-bit MODP Group with 160-bit prime order subgroup (RFC5114)
// -----BEGIN DH PARAMETERS-----
// MIIBDAKBgQCxC4+WoIDgHd6S3l6uXVTsUsmfvPsGo8aaap3KUtI7YWBz4oZ1oj0Y
// mDjvHi7mUsAT7LSuqQYRIySXXDzUm4O/rMvdfZDEvXCYSI6cIZpzck7/1vrlZEc4
// +qMaT/VbzMChUa9fDci0vUW/N982XBpl5oz9p21NpwjfH7K8LkpDcQKBgQCk0cvV
// w/00EmdlpELvuZkF+BBN0lisUH/WQGz/FCZtMSZv6h5cQVZLd35pD1UE8hMWAhe0
// sBuIal6RVH+eJ0n01/vX07mpLuGQnQ0iY/gKdqaiTAh6CR9THb8KAWm2oorWYqTR
// jnOvoy13nVkY0IvIhY9Nzvl8KiSFXm7rIrOy5QICAKA=
// -----END DH PARAMETERS-----
//
static const unsigned char dh1024_p[] =
{
0xB1,0x0B,0x8F,0x96,0xA0,0x80,0xE0,0x1D,0xDE,0x92,0xDE,0x5E,
@ -620,6 +639,58 @@ void Context::initDH(const std::string& dhParamsFile)
0x85,0x5E,0x6E,0xEB,0x22,0xB3,0xB2,0xE5,
};
static const unsigned char dh2048_p[] =
{
0x87,0xA8,0xE6,0x1D,0xB4,0xB6,0x66,0x3C,0xFF,0xBB,0xD1,0x9C,
0x65,0x19,0x59,0x99,0x8C,0xEE,0xF6,0x08,0x66,0x0D,0xD0,0xF2,
0x5D,0x2C,0xEE,0xD4,0x43,0x5E,0x3B,0x00,0xE0,0x0D,0xF8,0xF1,
0xD6,0x19,0x57,0xD4,0xFA,0xF7,0xDF,0x45,0x61,0xB2,0xAA,0x30,
0x16,0xC3,0xD9,0x11,0x34,0x09,0x6F,0xAA,0x3B,0xF4,0x29,0x6D,
0x83,0x0E,0x9A,0x7C,0x20,0x9E,0x0C,0x64,0x97,0x51,0x7A,0xBD,
0x5A,0x8A,0x9D,0x30,0x6B,0xCF,0x67,0xED,0x91,0xF9,0xE6,0x72,
0x5B,0x47,0x58,0xC0,0x22,0xE0,0xB1,0xEF,0x42,0x75,0xBF,0x7B,
0x6C,0x5B,0xFC,0x11,0xD4,0x5F,0x90,0x88,0xB9,0x41,0xF5,0x4E,
0xB1,0xE5,0x9B,0xB8,0xBC,0x39,0xA0,0xBF,0x12,0x30,0x7F,0x5C,
0x4F,0xDB,0x70,0xC5,0x81,0xB2,0x3F,0x76,0xB6,0x3A,0xCA,0xE1,
0xCA,0xA6,0xB7,0x90,0x2D,0x52,0x52,0x67,0x35,0x48,0x8A,0x0E,
0xF1,0x3C,0x6D,0x9A,0x51,0xBF,0xA4,0xAB,0x3A,0xD8,0x34,0x77,
0x96,0x52,0x4D,0x8E,0xF6,0xA1,0x67,0xB5,0xA4,0x18,0x25,0xD9,
0x67,0xE1,0x44,0xE5,0x14,0x05,0x64,0x25,0x1C,0xCA,0xCB,0x83,
0xE6,0xB4,0x86,0xF6,0xB3,0xCA,0x3F,0x79,0x71,0x50,0x60,0x26,
0xC0,0xB8,0x57,0xF6,0x89,0x96,0x28,0x56,0xDE,0xD4,0x01,0x0A,
0xBD,0x0B,0xE6,0x21,0xC3,0xA3,0x96,0x0A,0x54,0xE7,0x10,0xC3,
0x75,0xF2,0x63,0x75,0xD7,0x01,0x41,0x03,0xA4,0xB5,0x43,0x30,
0xC1,0x98,0xAF,0x12,0x61,0x16,0xD2,0x27,0x6E,0x11,0x71,0x5F,
0x69,0x38,0x77,0xFA,0xD7,0xEF,0x09,0xCA,0xDB,0x09,0x4A,0xE9,
0x1E,0x1A,0x15,0x97,
};
static const unsigned char dh2048_g[] =
{
0x3F,0xB3,0x2C,0x9B,0x73,0x13,0x4D,0x0B,0x2E,0x77,0x50,0x66,
0x60,0xED,0xBD,0x48,0x4C,0xA7,0xB1,0x8F,0x21,0xEF,0x20,0x54,
0x07,0xF4,0x79,0x3A,0x1A,0x0B,0xA1,0x25,0x10,0xDB,0xC1,0x50,
0x77,0xBE,0x46,0x3F,0xFF,0x4F,0xED,0x4A,0xAC,0x0B,0xB5,0x55,
0xBE,0x3A,0x6C,0x1B,0x0C,0x6B,0x47,0xB1,0xBC,0x37,0x73,0xBF,
0x7E,0x8C,0x6F,0x62,0x90,0x12,0x28,0xF8,0xC2,0x8C,0xBB,0x18,
0xA5,0x5A,0xE3,0x13,0x41,0x00,0x0A,0x65,0x01,0x96,0xF9,0x31,
0xC7,0x7A,0x57,0xF2,0xDD,0xF4,0x63,0xE5,0xE9,0xEC,0x14,0x4B,
0x77,0x7D,0xE6,0x2A,0xAA,0xB8,0xA8,0x62,0x8A,0xC3,0x76,0xD2,
0x82,0xD6,0xED,0x38,0x64,0xE6,0x79,0x82,0x42,0x8E,0xBC,0x83,
0x1D,0x14,0x34,0x8F,0x6F,0x2F,0x91,0x93,0xB5,0x04,0x5A,0xF2,
0x76,0x71,0x64,0xE1,0xDF,0xC9,0x67,0xC1,0xFB,0x3F,0x2E,0x55,
0xA4,0xBD,0x1B,0xFF,0xE8,0x3B,0x9C,0x80,0xD0,0x52,0xB9,0x85,
0xD1,0x82,0xEA,0x0A,0xDB,0x2A,0x3B,0x73,0x13,0xD3,0xFE,0x14,
0xC8,0x48,0x4B,0x1E,0x05,0x25,0x88,0xB9,0xB7,0xD2,0xBB,0xD2,
0xDF,0x01,0x61,0x99,0xEC,0xD0,0x6E,0x15,0x57,0xCD,0x09,0x15,
0xB3,0x35,0x3B,0xBB,0x64,0xE0,0xEC,0x37,0x7F,0xD0,0x28,0x37,
0x0D,0xF9,0x2B,0x52,0xC7,0x89,0x14,0x28,0xCD,0xC6,0x7E,0xB6,
0x18,0x4B,0x52,0x3D,0x1D,0xB2,0x46,0xC3,0x2F,0x63,0x07,0x84,
0x90,0xF0,0x0E,0xF8,0xD6,0x47,0xD1,0x48,0xD4,0x79,0x54,0x51,
0x5E,0x23,0x27,0xCF,0xEF,0x98,0xC5,0x82,0x66,0x4B,0x4C,0x0F,
0x6C,0xC4,0x16,0x59,
};
DH* dh = 0;
if (!dhParamsFile.empty())
{
@ -646,19 +717,38 @@ void Context::initDH(const std::string& dhParamsFile)
throw SSLContextException("Error creating Diffie-Hellman parameters", msg);
}
#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
if (use2048Bits)
{
BIGNUM* p = BN_bin2bn(dh2048_p, sizeof(dh2048_p), 0);
BIGNUM* g = BN_bin2bn(dh2048_g, sizeof(dh2048_g), 0);
DH_set0_pqg(dh, p, 0, g);
DH_set_length(dh, 256);
}
else
{
BIGNUM* p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), 0);
BIGNUM* g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), 0);
DH_set0_pqg(dh, p, 0, g);
DH_set_length(dh, 160);
}
if (!p || !g)
{
DH_free(dh);
throw SSLContextException("Error creating Diffie-Hellman parameters");
}
#else
if (use2048Bits)
{
dh->p = BN_bin2bn(dh2048_p, sizeof(dh2048_p), 0);
dh->g = BN_bin2bn(dh2048_g, sizeof(dh2048_g), 0);
dh->length = 256;
}
else
{
dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), 0);
dh->g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), 0);
dh->length = 160;
}
if ((!dh->p) || (!dh->g))
{
DH_free(dh);
@ -678,8 +768,25 @@ void Context::initDH(const std::string& dhParamsFile)
void Context::initECDH(const std::string& curve)
{
#if OPENSSL_VERSION_NUMBER >= 0x0090800fL
#ifndef OPENSSL_NO_ECDH
#if OPENSSL_VERSION_NUMBER >= 0x1000200fL
const std::string groups(curve.empty() ?
#if OPENSSL_VERSION_NUMBER >= 0x1010100fL
"X448:X25519:ffdhe4096:ffdhe3072:ffdhe2048:ffdhe6144:ffdhe8192:P-521:P-384:P-256"
#elif OPENSSL_VERSION_NUMBER >= 0x1010000fL
// while OpenSSL 1.1.0 didn't support Ed25519 (EdDSA using Curve25519),
// it did support X25519 (ECDH using Curve25516).
"X25519:P-521:P-384:P-256"
#else
"P-521:P-384:P-256"
#endif
: curve);
if (SSL_CTX_set1_curves_list(_pSSLContext, groups.c_str()) == 0)
{
throw SSLContextException("Cannot set ECDH groups", groups);
}
SSL_CTX_set_options(_pSSLContext, SSL_OP_SINGLE_ECDH_USE);
#elif OPENSSL_VERSION_NUMBER >= 0x0090800fL
int nid = 0;
if (!curve.empty())
{

View File

@ -163,14 +163,14 @@ Poco::Net::X509Certificate Context::certificate()
void Context::loadCertificate()
{
std::wstring wcertStore;
Poco::UnicodeConverter::convert(_certStoreName, wcertStore);
std::wstring wcertStoreName;
Poco::UnicodeConverter::convert(_certStoreName, wcertStoreName);
if (!_hCertStore)
{
if (_options & OPT_USE_MACHINE_STORE)
_hCertStore = CertOpenStore(CERT_STORE_PROV_SYSTEM, 0, 0, CERT_SYSTEM_STORE_LOCAL_MACHINE, _certStoreName.c_str());
_hCertStore = CertOpenStore(CERT_STORE_PROV_SYSTEM, 0, 0, CERT_SYSTEM_STORE_LOCAL_MACHINE, wcertStoreName.c_str());
else
_hCertStore = CertOpenSystemStoreW(0, wcertStore.c_str());
_hCertStore = CertOpenSystemStoreW(0, wcertStoreName.c_str());
}
if (!_hCertStore) throw CertificateException("Failed to open certificate store", _certStoreName, GetLastError());

View File

@ -381,13 +381,13 @@ void* X509Certificate::nid2oid(NID nid)
void X509Certificate::loadCertificate(const std::string& certName, const std::string& certStoreName, bool useMachineStore)
{
std::wstring wcertStore;
Poco::UnicodeConverter::convert(certStoreName, wcertStore);
std::wstring wcertStoreName;
Poco::UnicodeConverter::convert(certStoreName, wcertStoreName);
HCERTSTORE hCertStore;
if (useMachineStore)
hCertStore = CertOpenStore(CERT_STORE_PROV_SYSTEM, 0, 0, CERT_SYSTEM_STORE_LOCAL_MACHINE, certStoreName.c_str());
hCertStore = CertOpenStore(CERT_STORE_PROV_SYSTEM, 0, 0, CERT_SYSTEM_STORE_LOCAL_MACHINE, wcertStoreName.c_str());
else
hCertStore = CertOpenSystemStoreW(0, wcertStore.c_str());
hCertStore = CertOpenSystemStoreW(0, wcertStoreName.c_str());
if (!hCertStore) throw CertificateException("Failed to open certificate store", certStoreName, GetLastError());

View File

@ -1 +1 @@
1.10.0
1.10.1

View File

@ -233,20 +233,27 @@ configure_file("cmake/Poco${target_name}Config.cmake"
@ONLY
)
set(ConfigPackageLocation "lib/cmake/${PROJECT_NAME}")
# Set config script install location in a location that find_package() will
# look for, which is different on MS Windows than for UNIX
# Note: also set in root CMakeLists.txt
if (WIN32)
set(PocoConfigPackageLocation "cmake")
else()
set(PocoConfigPackageLocation "lib/cmake/${PROJECT_NAME}")
endif()
install(
EXPORT "${target_name}Targets"
FILE "${PROJECT_NAME}${target_name}Targets.cmake"
NAMESPACE "${PROJECT_NAME}::"
DESTINATION "lib${LIB_SUFFIX}/cmake/${PROJECT_NAME}"
DESTINATION "${PocoConfigPackageLocation}"
)
install(
FILES
"${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Config.cmake"
"${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}ConfigVersion.cmake"
DESTINATION "lib${LIB_SUFFIX}/cmake/${PROJECT_NAME}"
DESTINATION "${PocoConfigPackageLocation}"
COMPONENT Devel
)

View File

@ -1,6 +1,14 @@
POCO C++ Libraries Release Notes
AAAIntroduction
!!!Release 1.10.1
!!Summary of Changes
- TODO
!!!Release 1.10.0
!!Summary of Changes

View File

@ -1 +1 @@
70
71