1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-06-19 00:27:13 +02:00

Update POCO to 1.11.0

This commit is contained in:
Sandu Liviu Catalin
2021-08-22 18:07:06 +03:00
parent 151077c799
commit 7a3d92d1d1
450 changed files with 25219 additions and 6528 deletions

View File

@ -55,6 +55,13 @@ public:
/// Depending on the address family, the socket
/// will be either an IPv4 or an IPv6 socket.
DatagramSocket(const SocketAddress& address, bool reuseAddress, bool reusePort);
/// Creates a datagram socket and binds it
/// to the given address.
///
/// Depending on the address family, the socket
/// will be either an IPv4 or an IPv6 socket.
DatagramSocket(const Socket& socket);
/// Creates the DatagramSocket with the SocketImpl
/// from another socket. The SocketImpl must be

View File

@ -102,7 +102,7 @@ public:
void setContentType(const std::string& mediaType);
/// Sets the content type for this message.
///
/// Specify NO_CONTENT_TYPE to remove the
/// Specify UNKNOWN_CONTENT_TYPE to remove the
/// Content-Type header.
void setContentType(const MediaType& mediaType);

View File

@ -19,6 +19,7 @@
#include "Poco/Net/Net.h"
#include "Poco/Net/HTTPClientSession.h"
#include "Poco/Mutex.h"
#include "Poco/URI.h"
#include "Poco/SingletonHolder.h"
@ -31,7 +32,6 @@ namespace Net {
class HTTPSessionInstantiator;
class HTTPClientSession;
class Net_API HTTPSessionFactory
@ -52,6 +52,9 @@ public:
HTTPSessionFactory(const std::string& proxyHost, Poco::UInt16 proxyPort);
/// Creates the HTTPSessionFactory and sets the proxy host and port.
HTTPSessionFactory(const HTTPClientSession::ProxyConfig& proxyConfig);
/// Creates the HTTPSessionFactory and sets the proxy configuration.
~HTTPSessionFactory();
/// Destroys the HTTPSessionFactory.
@ -78,22 +81,28 @@ public:
const std::string& proxyHost() const;
/// Returns the proxy host, if one has been set, or an empty string otherwise.
Poco::UInt16 proxyPort() const;
/// Returns the proxy port number, if one has been set, or zero otherwise.
void setProxy(const std::string& proxyHost, Poco::UInt16 proxyPort);
/// Sets the proxy host and port number.
void setProxyCredentials(const std::string& username, const std::string& password);
/// Sets the username and password for proxy authorization (Basic auth only).
const std::string& proxyUsername() const;
/// Returns the username for proxy authorization.
const std::string& proxyPassword() const;
/// Returns the password for proxy authorization.
void setProxyConfig(const HTTPClientSession::ProxyConfig& proxyConfig);
/// Sets the proxy configuration.
const HTTPClientSession::ProxyConfig& getProxyConfig() const;
/// Returns the proxy configuration.
static HTTPSessionFactory& defaultFactory();
/// Returns the default HTTPSessionFactory.
@ -109,14 +118,11 @@ private:
HTTPSessionFactory(const HTTPSessionFactory&);
HTTPSessionFactory& operator = (const HTTPSessionFactory&);
typedef std::map<std::string, InstantiatorInfo> Instantiators;
Instantiators _instantiators;
std::string _proxyHost;
Poco::UInt16 _proxyPort;
std::string _proxyUsername;
std::string _proxyPassword;
HTTPClientSession::ProxyConfig _proxyConfig;
mutable Poco::FastMutex _mutex;
};
@ -127,25 +133,31 @@ private:
//
inline const std::string& HTTPSessionFactory::proxyHost() const
{
return _proxyHost;
return _proxyConfig.host;
}
inline Poco::UInt16 HTTPSessionFactory::proxyPort() const
{
return _proxyPort;
return _proxyConfig.port;
}
inline const std::string& HTTPSessionFactory::proxyUsername() const
{
return _proxyUsername;
return _proxyConfig.username;
}
inline const std::string& HTTPSessionFactory::proxyPassword() const
{
return _proxyPassword;
return _proxyConfig.password;
}
inline const HTTPClientSession::ProxyConfig& HTTPSessionFactory::getProxyConfig() const
{
return _proxyConfig;
}

View File

@ -19,7 +19,7 @@
#include "Poco/Net/Net.h"
#include "Poco/Net/HTTPSession.h"
#include "Poco/Net/HTTPClientSession.h"
#include "Poco/URI.h"
@ -27,9 +27,6 @@ namespace Poco {
namespace Net {
class HTTPClientSession;
class Net_API HTTPSessionInstantiator
/// A factory for HTTPClientSession objects.
///
@ -55,31 +52,15 @@ public:
/// Unregisters the factory with the global HTTPSessionFactory.
protected:
void setProxy(const std::string& host, Poco::UInt16 port);
/// Sets the proxy host and port.
/// Called by HTTPSessionFactory.
const std::string& proxyHost() const;
/// Returns the proxy post.
void setProxyConfig(const HTTPClientSession::ProxyConfig& proxyConfig);
/// Sets the proxy configuration.
Poco::UInt16 proxyPort() const;
/// Returns the proxy port.
void setProxyCredentials(const std::string& username, const std::string& password);
/// Sets the username and password for proxy authorization (Basic auth only).
const std::string& proxyUsername() const;
/// Returns the username for proxy authorization.
const std::string& proxyPassword() const;
/// Returns the password for proxy authorization.
const HTTPClientSession::ProxyConfig& getProxyConfig() const;
/// Returns the proxy configuration.
private:
std::string _proxyHost;
Poco::UInt16 _proxyPort;
std::string _proxyUsername;
std::string _proxyPassword;
HTTPClientSession::ProxyConfig _proxyConfig;
friend class HTTPSessionFactory;
};
@ -87,27 +68,9 @@ private:
//
// inlines
//
inline const std::string& HTTPSessionInstantiator::proxyHost() const
inline const HTTPClientSession::ProxyConfig& HTTPSessionInstantiator::getProxyConfig() const
{
return _proxyHost;
}
inline Poco::UInt16 HTTPSessionInstantiator::proxyPort() const
{
return _proxyPort;
}
inline const std::string& HTTPSessionInstantiator::proxyUsername() const
{
return _proxyUsername;
}
inline const std::string& HTTPSessionInstantiator::proxyPassword() const
{
return _proxyPassword;
return _proxyConfig;
}

View File

@ -76,6 +76,14 @@ public:
/// for the host.
private:
template <typename C>
void removeDuplicates(C& list)
{
std::sort(list.begin(), list.end());
auto last = std::unique(list.begin(), list.end());
list.erase(last, list.end());
}
std::string _name;
AliasList _aliases;
AddressList _addresses;

View File

@ -43,7 +43,7 @@ public:
virtual int packetSize() const = 0;
/// Returns the total size of packet (ICMP header + data) in number of octets.
/// Must be overriden.
/// Must be overridden.
virtual int maxPacketSize() const;
/// Returns the maximum permitted size of packet in number of octets.
@ -60,16 +60,16 @@ public:
virtual struct timeval time(Poco::UInt8* buffer = 0, int length = 0) const = 0;
/// Returns current epoch time if either argument is equal to zero.
/// Otherwise, it extracts the time value from the supplied buffer.
///
///
/// Supplied buffer includes IP header, ICMP header and data.
/// Must be overriden.
/// Must be overridden.
virtual bool validReplyID(unsigned char* buffer, int length) const = 0;
/// Returns true if the extracted id is recognized
/// Returns true if the extracted id is recognized
/// (i.e. equals the process id).
///
///
/// Supplied buffer includes IP header, ICMP header and data.
/// Must be overriden.
/// Must be overridden.
virtual std::string errorDescription(Poco::UInt8* buffer, int length, int& type, int& code) = 0;
/// Returns error description string.
@ -79,11 +79,11 @@ public:
/// assigned to the type and code respectively.
///
/// Supplied buffer includes IP header, ICMP header and data.
/// Must be overriden.
/// Must be overridden.
virtual std::string typeDescription(int typeId) = 0;
/// Returns the description of the packet type.
/// Must be overriden.
/// Must be overridden.
static const Poco::UInt16 MAX_PACKET_SIZE;
static const Poco::UInt16 MAX_PAYLOAD_SIZE;
@ -98,7 +98,7 @@ protected:
virtual void initPacket() = 0;
/// (Re)assembles the packet.
/// Must be overriden.
/// Must be overridden.
Poco::UInt16 checksum(Poco::UInt16 *addr, Poco::Int32 len);
/// Calculates the checksum for supplied buffer.
@ -107,7 +107,7 @@ private:
Poco::UInt16 _seq;
Poco::UInt8* _pPacket;
int _dataSize;
};

View File

@ -61,7 +61,6 @@ public:
#define POCO_RESTORE_TIMESTAMP_REQUEST
#undef TIMESTAMP_REQUEST
#endif
enum MessageType
{
ECHO_REPLY,
@ -84,9 +83,8 @@ public:
MESSAGE_TYPE_UNKNOWN, // non-standard default, must remain last but one
MESSAGE_TYPE_LENGTH // length indicator, must remain last
};
#if defined(POCO_RESTORE_TIMESTAMP_REQUEST)
#pragma pop_macro("TIMESTAMP_REQUEST")
#pragma pop_macro("TIMESTAMP_REQUEST")
#undef POCO_RESTORE_TIMESTAMP_REQUEST
#endif

View File

@ -124,6 +124,7 @@ public:
/// by a colon) can also be specified.
/// * host: (optional) Host name included in syslog messages. If not specified, the host's real domain name or
/// IP address will be used.
/// * buffer: UDP socket send buffer size in bytes. If not specified, the system default is used.
std::string getProperty(const std::string& name) const;
/// Returns the value of the property with the given name.
@ -136,6 +137,7 @@ public:
static const std::string PROP_FORMAT;
static const std::string PROP_LOGHOST;
static const std::string PROP_HOST;
static const std::string PROP_BUFFER;
static const std::string STRUCTURED_DATA;
protected:
@ -148,6 +150,7 @@ private:
std::string _host;
int _facility;
bool _bsdFormat;
int _buffer;
DatagramSocket _socket;
SocketAddress _socketAddress;
bool _open;

View File

@ -63,6 +63,13 @@ public:
/// Creates the RemoteSyslogListener, listening on the given port number
/// and using the number of threads for message processing.
RemoteSyslogListener(Poco::UInt16 port, bool reusePort, int threads);
/// Creates the RemoteSyslogListener, listening on the given port number
/// and using the number of threads for message processing.
///
/// If reusePort is true, the underlying UDP socket will bind
/// with the reusePort flag set.
void setProperty(const std::string& name, const std::string& value);
/// Sets the property with the given value.
///
@ -70,9 +77,13 @@ public:
/// * port: The UDP port number where to listen for UDP packets
/// containing syslog messages. If 0 is specified, does not
/// listen for UDP messages.
/// * reusePort: If set to true, allows multiple instances
/// binding to the same port number.
/// * threads: The number of parser threads processing
/// received syslog messages. Defaults to 1. A maximum
/// of 16 threads is supported.
/// * buffer: The UDP socket receive buffer size in bytes. If not
/// specified, the system default is used.
std::string getProperty(const std::string& name) const;
/// Returns the value of the property with the given name.
@ -95,7 +106,9 @@ public:
/// Registers the channel with the global LoggingFactory.
static const std::string PROP_PORT;
static const std::string PROP_REUSE_PORT;
static const std::string PROP_THREADS;
static const std::string PROP_BUFFER;
static const std::string LOG_PROP_APP;
static const std::string LOG_PROP_HOST;
@ -111,7 +124,9 @@ private:
Poco::ThreadPool _threadPool;
Poco::NotificationQueue _queue;
Poco::UInt16 _port;
bool _reusePort;
int _threads;
int _buffer;
};

View File

@ -34,7 +34,7 @@ namespace Net {
struct NTLMContextImpl;
class NTLMContext
class Net_API NTLMContext
/// An opaque context class for working with SSPI NTLM authentication.
{
public:
@ -49,7 +49,7 @@ private:
NTLMContext();
NTLMContext(const NTLMContext&);
NTLMContext& operator = (const NTLMContext&);
friend class SSPINTLMProvider;
};

View File

@ -85,7 +85,7 @@ public:
/// If reuseAddress is true, sets the SO_REUSEADDR
/// socket option.
virtual void bind(const SocketAddress& address, bool reuseAddress, bool reusePort );
virtual void bind(const SocketAddress& address, bool reuseAddress, bool reusePort);
/// Bind a local address to the socket.
///
/// This is usually only done when establishing a server
@ -115,7 +115,7 @@ public:
/// If the library has not been built with IPv6 support,
/// a Poco::NotImplementedException will be thrown.
virtual void bind6(const SocketAddress& address, bool reuseAddress, bool reusePort, bool ipV6Only);
virtual void bind6(const SocketAddress& address, bool reuseAddress, bool reusePort, bool ipV6Only);
/// Bind a local IPv6 address to the socket.
///
/// This is usually only done when establishing a server

View File

@ -65,7 +65,7 @@ public:
virtual int handleResponse(char* buffer, int length);
/// Handles responses from UDP server. For non-POCO UDP servers,
/// this function should be overriden in inheriting class.
/// this function should be overridden in inheriting class.
void setOption(int opt, int val);
/// Sets socket option.

View File

@ -313,7 +313,7 @@ public:
virtual void processData(char*)
/// Caled when data is received by reader.
///
/// No-op here, must be overriden by inheriting
/// No-op here, must be overridden by inheriting
/// class in order to do useful work.
{
};
@ -322,7 +322,7 @@ public:
/// Caled when error is detected by reader.
///
/// Only functional if stream pointer is provided
/// to the handler, otherwise it must be overriden
/// to the handler, otherwise it must be overridden
/// by inheriting class in order to do useful work.
{
if (_pErr) *_pErr << error(buf) << std::endl;

View File

@ -150,6 +150,9 @@ public:
///
/// The result of the handshake can be obtained from the response
/// object.
///
/// The HTTPClientSession session object must no longer be used after setting
/// up the WebSocket.
WebSocket(HTTPClientSession& cs, HTTPRequest& request, HTTPResponse& response, HTTPCredentials& credentials);
/// Creates a client-side WebSocket, using the given
@ -165,6 +168,9 @@ public:
///
/// The result of the handshake can be obtained from the response
/// object.
///
/// The HTTPClientSession session object must no longer be used after setting
/// up the WebSocket.
WebSocket(const Socket& socket);
/// Creates a WebSocket from another Socket, which must be a WebSocket,
@ -218,9 +224,11 @@ public:
/// A WebSocketException will also be thrown if a malformed
/// or incomplete frame is received.
///
/// Returns the number of bytes received.
/// A return value of 0 means that the peer has
/// Returns the number of payload bytes received.
/// A return value of 0, with flags also 0, means that the peer has
/// shut down or closed the connection.
/// A return value of 0, with non-zero flags, indicates an
/// reception of an empty frame (e.g., in case of a PING).
///
/// Throws a TimeoutException if a receive timeout has
/// been set and nothing is received within that interval.
@ -248,9 +256,11 @@ public:
/// DoS attack (memory exhaustion) by sending a WebSocket frame
/// header with a huge payload size.
///
/// Returns the number of bytes received.
/// A return value of 0 means that the peer has
/// Returns the number of payload bytes received.
/// A return value of 0, with flags also 0, means that the peer has
/// shut down or closed the connection.
/// A return value of 0, with non-zero flags, indicates an
/// reception of an empty frame (e.g., in case of a PING).
///
/// Throws a TimeoutException if a receive timeout has
/// been set and nothing is received within that interval.