Browse Source

latest changes from main repository

Guenter Obiltschnig 19 years ago
parent
commit
4d80e24d44

+ 3 - 0
Foundation/Foundation_vs71.vcproj

@@ -635,6 +635,9 @@
 				<File
 					RelativePath=".\include\Poco\MetaProgramming.h">
 				</File>
+				<File
+					RelativePath=".\include\Poco\NamedTuple.h">
+				</File>
 				<File
 					RelativePath=".\include\Poco\NestedDiagnosticContext.h">
 				</File>

+ 21 - 3
Foundation/include/Poco/ClassLibrary.h

@@ -1,7 +1,7 @@
 //
 // ClassLibrary.h
 //
-// $Id: //poco/Main/Foundation/include/Poco/ClassLibrary.h#3 $
+// $Id: //poco/Main/Foundation/include/Poco/ClassLibrary.h#4 $
 //
 // Library: Foundation
 // Package: SharedLibrary
@@ -63,6 +63,16 @@ extern "C"
 } 
 
 
+//
+// additional support for named manifests
+//
+#define POCO_DECLARE_NAMED_MANIFEST(name) \
+extern "C"	\
+{			\
+	void POCO_LIBRARY_API POCO_JOIN(pocoBuildManifest, name)(Poco::ManifestBase* pManifest); \
+}
+
+
 //
 // Macros to automatically implement pocoBuildManifest
 //
@@ -74,8 +84,8 @@ extern "C"
 //     ...
 // POCO_END_MANIFEST
 //
-#define POCO_BEGIN_MANIFEST(base) \
-	bool pocoBuildManifest(Poco::ManifestBase* pManifest_)							\
+#define POCO_BEGIN_MANIFEST_IMPL(fnName, base) \
+	bool fnName(Poco::ManifestBase* pManifest_)										\
 	{																				\
 		typedef base _Base;															\
 		typedef Poco::Manifest<_Base> _Manifest;									\
@@ -86,6 +96,14 @@ extern "C"
 			Poco::Manifest<_Base>* pManifest = static_cast<_Manifest*>(pManifest_);
 
 
+#define POCO_BEGIN_MANIFEST(base) \
+	POCO_BEGIN_MANIFEST_IMPL(pocoBuildManifest, base)
+
+
+#define POCO_BEGIN_NAMED_MANIFEST(name, base) \
+	POCO_BEGIN_MANIFEST_IMPL(POCO_JOIN(pocoBuildManifest, name), base)
+
+
 #define POCO_END_MANIFEST \
 			return true;	\
 		}					\

+ 35 - 8
Foundation/include/Poco/ClassLoader.h

@@ -1,7 +1,7 @@
 //
 // ClassLoader.h
 //
-// $Id: //poco/Main/Foundation/include/Poco/ClassLoader.h#2 $
+// $Id: //poco/Main/Foundation/include/Poco/ClassLoader.h#3 $
 //
 // Library: Foundation
 // Package: SharedLibrary
@@ -62,6 +62,15 @@ class ClassLoader
 	/// The Manifest for a shared library can be easily built
 	/// with the help of the macros in the header file
 	/// "Foundation/ClassLibrary.h".
+	///
+	/// Starting with POCO release 1.3, a class library can
+	/// export multiple manifests. In addition to the default
+	/// (unnamed) manifest, multiple named manifests can
+	/// be exported, each having a different base class.
+	///
+	/// There is one important restriction: one instance of
+	/// ClassLoader can only load one manifest from a class
+	/// library.
 {
 public:
 	typedef AbstractMetaObject<Base> Meta;
@@ -152,9 +161,9 @@ public:
 		}
 	}
 
-	void loadLibrary(const std::string& path)
-		/// Loads a library from the given path. Does nothing
-		/// if the library is already loaded.
+	void loadLibrary(const std::string& path, const std::string& manifest)
+		/// Loads a library from the given path, using the given manifest. 
+		/// Does nothing if the library is already loaded.
 		/// Throws a LibraryLoadException if the library
 		/// cannot be loaded or does not have a Manifest.
 		/// If the library exports a function named "pocoInitializeLibrary",
@@ -174,20 +183,22 @@ public:
 			li.refCount  = 1;
 			try
 			{
+				std::string pocoBuildManifestSymbol("pocoBuildManifest");
+				pocoBuildManifestSymbol.append(manifest);
 				if (li.pLibrary->hasSymbol("pocoInitializeLibrary"))
 				{
 					InitializeLibraryFunc initializeLibrary = (InitializeLibraryFunc) li.pLibrary->getSymbol("pocoInitializeLibrary");
 					initializeLibrary();
 				}
-				if (li.pLibrary->hasSymbol("pocoBuildManifest"))
+				if (li.pLibrary->hasSymbol(pocoBuildManifestSymbol))
 				{
-					BuildManifestFunc buildManifest = (BuildManifestFunc) li.pLibrary->getSymbol("pocoBuildManifest");
+					BuildManifestFunc buildManifest = (BuildManifestFunc) li.pLibrary->getSymbol(pocoBuildManifestSymbol);
 					if (buildManifest(const_cast<Manif*>(li.pManifest)))
 						_map[path] = li;
 					else
-						throw LibraryLoadException(std::string("Manifest class mismatch in ") + path);
+						throw LibraryLoadException(std::string("Manifest class mismatch in ") + path, manifest);
 				}
-				else throw LibraryLoadException(std::string("No manifest in ") + path);
+				else throw LibraryLoadException(std::string("No manifest in ") + path, manifest);
 			}
 			catch (...)
 			{
@@ -202,6 +213,22 @@ public:
 		}
 	}
 
+	void loadLibrary(const std::string& path)
+		/// Loads a library from the given path. Does nothing
+		/// if the library is already loaded.
+		/// Throws a LibraryLoadException if the library
+		/// cannot be loaded or does not have a Manifest.
+		/// If the library exports a function named "pocoInitializeLibrary",
+		/// this function is executed.
+		/// If called multiple times for the same library,
+		/// the number of calls to unloadLibrary() must be the same
+		/// for the library to become unloaded.
+		///
+		/// Equivalent to loadLibrary(path, "").
+	{
+		loadLibrary(path, "");
+	}
+		
 	void unloadLibrary(const std::string& path)
 		/// Unloads the given library. 
 		/// Be extremely cautious when unloading shared libraries.

+ 24 - 7
Foundation/include/Poco/DynamicAny.h

@@ -1,7 +1,7 @@
 //
 // DynamicAny.h
 //
-// $Id: //poco/Main/Foundation/include/Poco/DynamicAny.h#6 $
+// $Id: //poco/Main/Foundation/include/Poco/DynamicAny.h#8 $
 //
 // Library: Foundation
 // Package: Core
@@ -175,17 +175,34 @@ public:
 	bool operator == (const T& other)
 		/// Equality operator
 	{
-		T result;
-		_pHolder->convert(result);
-		return result == other;
+		T value;
+		_pHolder->convert(value);
+		return value == other;
 	}
 
 	bool operator == (const char* other)
 		/// Equality operator
 	{
-		std::string result;
-		_pHolder->convert(result);
-		return result == other;
+		std::string value;
+		_pHolder->convert(value);
+		return value == other;
+	}
+
+	template <typename T> 
+	bool operator != (const T& other)
+		/// Inequality operator
+	{
+		T value;
+		_pHolder->convert(value);
+		return value != other;
+	}
+
+	bool operator != (const char* other)
+		/// Inequality operator
+	{
+		std::string value;
+		_pHolder->convert(value);
+		return value != other;
 	}
 
     const std::type_info& type() const;

+ 1 - 1
Foundation/include/Poco/DynamicAnyHolder.h

@@ -1,7 +1,7 @@
 //
 // DynamicAnyHolder.h
 //
-// $Id: //poco/Main/Foundation/include/Poco/DynamicAnyHolder.h#6 $
+// $Id: //poco/Main/Foundation/include/Poco/DynamicAnyHolder.h#7 $
 //
 // Library: Foundation
 // Package: Core

+ 3 - 3
Foundation/include/Poco/Foundation.h

@@ -1,7 +1,7 @@
 //
 // Foundation.h
 //
-// $Id: //poco/Main/Foundation/include/Poco/Foundation.h#7 $
+// $Id: //poco/Main/Foundation/include/Poco/Foundation.h#8 $
 //
 // Library: Foundation
 // Package: Core
@@ -102,8 +102,8 @@
 // is that macro expansion of macro arguments does not
 // occur in POCO_DO_JOIN2 but does in POCO_DO_JOIN.
 //
-#define POCO_JOIN(X, Y) POCO_DO_JOIN( X, Y )
-#define POCO_DO_JOIN(X, Y) POCO_DO_JOIN2(X,Y)
+#define POCO_JOIN(X, Y) POCO_DO_JOIN(X, Y)
+#define POCO_DO_JOIN(X, Y) POCO_DO_JOIN2(X, Y)
 #define POCO_DO_JOIN2(X, Y) X##Y
 
 

+ 2 - 2
Foundation/include/Poco/NamedTuple.h

@@ -1,7 +1,7 @@
 //
 // NamedTuple.h
 //
-// $Id: //poco/Main/Foundation/include/Poco/NamedTuple.h#6 $
+// $Id: //poco/Main/Foundation/include/Poco/NamedTuple.h#1 $
 //
 // Library: Foundation
 // Package: Core
@@ -9,7 +9,7 @@
 //
 // Definition of the NamedTuple class.
 //
-// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
+// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
 // and Contributors.
 //
 // Permission is hereby granted, free of charge, to any person or organization

+ 1 - 4
Foundation/include/Poco/Platform_WIN32.h

@@ -1,7 +1,7 @@
 //
 // Platform_WIN32.h
 //
-// $Id: //poco/Main/Foundation/include/Poco/Platform_WIN32.h#3 $
+// $Id: //poco/Main/Foundation/include/Poco/Platform_WIN32.h#4 $
 //
 // Library: Foundation
 // Package: Core
@@ -69,9 +69,6 @@
 #if defined(UNICODE) && !defined(POCO_WIN32_UTF8)
 #define POCO_WIN32_UTF8
 #endif
-#if defined(POCO_WIN32_UTF8) && !defined(UNICODE)
-#define UNICODE
-#endif
 
 
 // Turn off some annoying warnings

+ 4 - 4
Foundation/include/Poco/RegularExpression.h

@@ -1,7 +1,7 @@
 //
 // RegularExpression.h
 //
-// $Id: //poco/Main/Foundation/include/Poco/RegularExpression.h#4 $
+// $Id: //poco/Main/Foundation/include/Poco/RegularExpression.h#5 $
 //
 // Library: Foundation
 // Package: RegExp
@@ -77,9 +77,9 @@ public:
 		/// some can be passed only to matching functions, and some can be used
 		/// everywhere.
 		/// 
-		/// * Options marked [ctor] can be passed to the constructor.
-		/// * Options marked [match] can be passed to match, extract, split and subst.
-		/// * Options marked [subst] can be passed to subst.
+		///   * Options marked [ctor] can be passed to the constructor.
+		///   * Options marked [match] can be passed to match, extract, split and subst.
+		///   * Options marked [subst] can be passed to subst.
 		///
 		/// See the PCRE documentation for more information.
 	{

+ 3 - 3
Foundation/src/Environment_WIN32U.cpp

@@ -1,7 +1,7 @@
 //
 // Environment_WIN32U.cpp
 //
-// $Id: //poco/Main/Foundation/src/Environment_WIN32U.cpp#6 $
+// $Id: //poco/Main/Foundation/src/Environment_WIN32U.cpp#7 $
 //
 // Library: Foundation
 // Package: Core
@@ -105,9 +105,9 @@ std::string EnvironmentImpl::osNameImpl()
 
 std::string EnvironmentImpl::osVersionImpl()
 {
-	OSVERSIONINFO vi;
+	OSVERSIONINFOW vi;
 	vi.dwOSVersionInfoSize = sizeof(vi);
-	if (GetVersionEx(&vi) == 0) throw SystemException("Cannot get OS version information");
+	if (GetVersionExW(&vi) == 0) throw SystemException("Cannot get OS version information");
 	std::ostringstream str;
 	str << vi.dwMajorVersion << "." << vi.dwMinorVersion << " (Build " << (vi.dwBuildNumber & 0xFFFF);
 	std::string version;

+ 1 - 1
Foundation/src/pocomsg.h

@@ -1,7 +1,7 @@
 //
 // pocomsg.mc[.h]
 //
-// $Id: //poco/Main/Foundation/src/pocomsg.h#20 $
+// $Id: //poco/Main/Foundation/src/pocomsg.mc#7 $
 //
 // The Poco message source/header file.
 //

+ 6 - 0
Foundation/testsuite/TestSuite_vs71.vcproj

@@ -289,6 +289,9 @@
 				<File
 					RelativePath=".\src\MemoryPoolTest.cpp">
 				</File>
+				<File
+					RelativePath=".\src\NamedTuplesTest.cpp">
+				</File>
 				<File
 					RelativePath=".\src\NDCTest.cpp">
 				</File>
@@ -353,6 +356,9 @@
 				<File
 					RelativePath=".\src\MemoryPoolTest.h">
 				</File>
+				<File
+					RelativePath=".\src\NamedTuplesTest.h">
+				</File>
 				<File
 					RelativePath=".\src\NDCTest.h">
 				</File>

+ 1 - 1
Foundation/testsuite/src/CoreTestSuite.cpp

@@ -1,7 +1,7 @@
 //
 // CoreTestSuite.cpp
 //
-// $Id: //poco/Main/Foundation/testsuite/src/CoreTestSuite.cpp#20 $
+// $Id: //poco/Main/Foundation/testsuite/src/CoreTestSuite.cpp#21 $
 //
 // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
 // and Contributors.

+ 1 - 1
Foundation/testsuite/src/DynamicAnyTest.cpp

@@ -1,7 +1,7 @@
 //
 // DynamicAnyTest.cpp
 //
-// $Id: //poco/Main/Foundation/testsuite/src/DynamicAnyTest.cpp#6 $
+// $Id: //poco/Main/Foundation/testsuite/src/DynamicAnyTest.cpp#7 $
 //
 // Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
 // and Contributors.

+ 1 - 1
Foundation/testsuite/src/NamedTuplesTest.cpp

@@ -1,7 +1,7 @@
 //
 // NamedTuplesTest.cpp
 //
-// $Id: //poco/Main/Foundation/testsuite/src/NamedTuplesTest.cpp#4 $
+// $Id: //poco/Main/Foundation/testsuite/src/NamedTuplesTest.cpp#1 $
 //
 // Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
 // and Contributors.

+ 1 - 1
Foundation/testsuite/src/NamedTuplesTest.h

@@ -1,7 +1,7 @@
 //
 // NamedTuplesTest.h
 //
-// $Id: //poco/Main/Foundation/testsuite/src/NamedTuplesTest.h#4 $
+// $Id: //poco/Main/Foundation/testsuite/src/NamedTuplesTest.h#1 $
 //
 // Definition of the NamedTuplesTest class.
 //

+ 2 - 23
NetSSL_OpenSSL/include/Poco/Net/HTTPSClientSession.h

@@ -1,7 +1,7 @@
 //
 // HTTPSClientSession.h
 //
-// $Id: //poco/Main/NetSSL_OpenSSL/include/Poco/Net/HTTPSClientSession.h#6 $
+// $Id: //poco/Main/NetSSL_OpenSSL/include/Poco/Net/HTTPSClientSession.h#7 $
 //
 // Library: NetSSL_OpenSSL
 // Package: HTTPSClient
@@ -92,28 +92,7 @@ public:
 	~HTTPSClientSession();
 		/// Destroys the HTTPSClientSession and closes
 		/// the underlying socket.
-		
-	std::ostream& sendRequest(HTTPRequest& request);
-		/// Sends the header for the given HTTPS request to
-		/// the server.
-		///
-		/// The HTTPSClientSession will set the request's
-		/// Host and Keep-Alive headers accordingly.
-		///
-		/// The returned output stream can be used to write
-		/// the request body. The stream is valid until
-		/// receiveResponse() is called or the session
-		/// is destroyed.
-		
-	std::istream& receiveResponse(HTTPResponse& response);
-		/// Receives the header for the response to the previous 
-		/// HTTPS request.
-		///
-		/// The returned input stream can be used to read
-		/// the response body. The stream is valid until
-		/// sendRequest() is called or the session is
-		/// destroyed.
-	
+
 protected:
 	void connect(const SocketAddress& address);
 		// Connects the socket to the server.

+ 1 - 69
NetSSL_OpenSSL/src/HTTPSClientSession.cpp

@@ -1,7 +1,7 @@
 //
 // HTTPSClientSession.cpp
 //
-// $Id: //poco/Main/NetSSL_OpenSSL/src/HTTPSClientSession.cpp#11 $
+// $Id: //poco/Main/NetSSL_OpenSSL/src/HTTPSClientSession.cpp#12 $
 //
 // Library: NetSSL_OpenSSL
 // Package: HTTPSClient
@@ -82,74 +82,6 @@ HTTPSClientSession::~HTTPSClientSession()
 }
 
 
-std::ostream& HTTPSClientSession::sendRequest(HTTPRequest& request)
-{
-	deleteResponseStream();
-
-	bool keepAlive = getKeepAlive();
-	if (connected() && !keepAlive)
-		close();
-	if (!connected())
-		reconnect();
-	if (!keepAlive)
-		request.setKeepAlive(false);
-	request.setHost(getHost(), getPort());
-	
-	{
-		HTTPHeaderOutputStream hos(*this);
-		setReconnect(keepAlive);
-		request.write(hos);
-		setReconnect(false);
-		setExpectResponseBody(request.getMethod() != HTTPRequest::HTTP_HEAD);
-	}
-	if (request.getChunkedTransferEncoding())
-		setRequestStream(new HTTPChunkedOutputStream(*this));
-	else if (request.getContentLength() != HTTPMessage::UNKNOWN_CONTENT_LENGTH)
-		setRequestStream(new HTTPFixedLengthOutputStream(*this, request.getContentLength()));
-	else if (request.getMethod() == HTTPRequest::HTTP_GET || request.getMethod() == HTTPRequest::HTTP_HEAD)
-		setRequestStream(new HTTPFixedLengthOutputStream(*this, 0));
-	else
-		setRequestStream(new HTTPOutputStream(*this));
-
-	return *getRequestStream();
-}
-
-
-std::istream& HTTPSClientSession::receiveResponse(HTTPResponse& response)
-{
-	deleteRequestStream();
-
-	do
-	{
-		response.clear();
-		HTTPHeaderInputStream his(*this);
-		try
-		{
-			response.read(his);
-		}
-		catch (MessageException&)
-		{
-			if (networkException())
-				networkException()->rethrow();
-			else
-				throw;
-		}
-	}
-	while (response.getStatus() == HTTPResponse::HTTP_CONTINUE);
-
-	if (!getExpectResponseBody())
-		setResponseStream(new HTTPFixedLengthInputStream(*this, 0));
-	else if (response.getChunkedTransferEncoding())
-		setResponseStream(new HTTPChunkedInputStream(*this));
-	else if (response.getContentLength() != HTTPMessage::UNKNOWN_CONTENT_LENGTH)
-		setResponseStream(new HTTPFixedLengthInputStream(*this, response.getContentLength()));
-	else
-		setResponseStream(new HTTPInputStream(*this));
-		
-	return *getResponseStream();
-}
-
-
 std::string HTTPSClientSession::getHostInfo() const
 {
 	std::string result("https://");

+ 77 - 5
NetSSL_OpenSSL/testsuite/src/HTTPSClientSessionTest.cpp

@@ -1,7 +1,7 @@
 //
 // HTTPSClientSessionTest.cpp
 //
-// $Id: //poco/Main/NetSSL_OpenSSL/testsuite/src/HTTPSClientSessionTest.cpp#7 $
+// $Id: //poco/Main/NetSSL_OpenSSL/testsuite/src/HTTPSClientSessionTest.cpp#8 $
 //
 // Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
 // and Contributors.
@@ -35,7 +35,13 @@
 #include "CppUnit/TestSuite.h"
 #include "Poco/Net/HTTPSClientSession.h"
 #include "Poco/Net/HTTPRequest.h"
+#include "Poco/Net/HTTPRequestHandler.h"
+#include "Poco/Net/HTTPRequestHandlerFactory.h"
 #include "Poco/Net/HTTPResponse.h"
+#include "Poco/Net/HTTPServer.h"
+#include "Poco/Net/HTTPServerResponse.h"
+#include "Poco/Net/HTTPServerRequest.h"
+#include "Poco/Net/HTTPServerParams.h"
 #include "Poco/StreamCopier.h"
 #include "Poco/Exception.h"
 #include "HTTPSTestServer.h"
@@ -44,13 +50,45 @@
 #include <sstream>
 
 
-using Poco::Net::HTTPSClientSession;
-using Poco::Net::HTTPRequest;
-using Poco::Net::HTTPResponse;
-using Poco::Net::HTTPMessage;
+using namespace Poco::Net;
+
 using Poco::StreamCopier;
 
 
+
+class TestRequestHandler: public HTTPRequestHandler
+	/// Return a HTML document with the current date and time.
+{
+public:
+	TestRequestHandler()
+	{
+	}
+	
+	void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response)
+	{
+		response.setChunkedTransferEncoding(true);
+		response.setContentType(request.getContentType());
+		std::ostream& ostr = response.send();
+		Poco::StreamCopier::copyStream(request.stream(), ostr);
+	}
+
+};
+
+
+class TestRequestHandlerFactory: public HTTPRequestHandlerFactory
+{
+public:
+	TestRequestHandlerFactory()
+	{
+	}
+
+	HTTPRequestHandler* createRequestHandler(const HTTPServerRequest& request)
+	{
+		return new TestRequestHandler();
+	}
+};
+
+
 HTTPSClientSessionTest::HTTPSClientSessionTest(const std::string& name): CppUnit::TestCase(name)
 {
 }
@@ -179,6 +217,39 @@ void HTTPSClientSessionTest::testPostLargeChunked()
 }
 
 
+void HTTPSClientSessionTest::testPostLargeChunkedKeepAlive()
+{
+	SecureServerSocket svs(32322);
+	HTTPServer srv(new TestRequestHandlerFactory(), svs, new HTTPServerParams());
+	srv.start();
+	try
+	{
+		HTTPSClientSession s("localhost", srv.port());
+		s.setKeepAlive(true);
+		for (int i = 0; i < 10; ++i)
+		{
+			HTTPRequest request(HTTPRequest::HTTP_POST, "/keepAlive", HTTPMessage::HTTP_1_1);
+			std::string body(16000, 'x');
+			request.setChunkedTransferEncoding(true);
+			s.sendRequest(request) << body;
+			HTTPResponse response;
+			std::istream& rs = s.receiveResponse(response);
+			assert (response.getChunkedTransferEncoding());
+			assert (response.getContentLength() == HTTPMessage::UNKNOWN_CONTENT_LENGTH);
+			std::ostringstream ostr;
+			StreamCopier::copyStream(rs, ostr);
+			assert (ostr.str() == body);
+		}
+		srv.stop();
+	}
+	catch (...)
+	{
+		srv.stop();
+		throw;
+	}
+}
+
+
 void HTTPSClientSessionTest::testPostSmallClose()
 {
 	HTTPSTestServer srv;
@@ -297,6 +368,7 @@ CppUnit::Test* HTTPSClientSessionTest::suite()
 	CppUnit_addTest(pSuite, HTTPSClientSessionTest, testPostLargeIdentity);
 	CppUnit_addTest(pSuite, HTTPSClientSessionTest, testPostSmallChunked);
 	CppUnit_addTest(pSuite, HTTPSClientSessionTest, testPostLargeChunked);
+	CppUnit_addTest(pSuite, HTTPSClientSessionTest, testPostLargeChunkedKeepAlive);
 	CppUnit_addTest(pSuite, HTTPSClientSessionTest, testPostSmallClose);
 	CppUnit_addTest(pSuite, HTTPSClientSessionTest, testPostLargeClose);
 	CppUnit_addTest(pSuite, HTTPSClientSessionTest, testKeepAlive);

+ 2 - 1
NetSSL_OpenSSL/testsuite/src/HTTPSClientSessionTest.h

@@ -1,7 +1,7 @@
 //
 // HTTPSClientSessionTest.h
 //
-// $Id: //poco/Main/NetSSL_OpenSSL/testsuite/src/HTTPSClientSessionTest.h#7 $
+// $Id: //poco/Main/NetSSL_OpenSSL/testsuite/src/HTTPSClientSessionTest.h#8 $
 //
 // Definition of the HTTPSClientSessionTest class.
 //
@@ -53,6 +53,7 @@ public:
 	void testPostLargeIdentity();
 	void testPostSmallChunked();
 	void testPostLargeChunked();
+	void testPostLargeChunkedKeepAlive();
 	void testPostSmallClose();
 	void testPostLargeClose();
 	void testKeepAlive();

+ 5 - 2
NetSSL_OpenSSL/testsuite/src/HTTPSTestServer.cpp

@@ -1,7 +1,7 @@
 //
 // HTTPSTestServer.cpp
 //
-// $Id: //poco/Main/NetSSL_OpenSSL/testsuite/src/HTTPSTestServer.cpp#8 $
+// $Id: //poco/Main/NetSSL_OpenSSL/testsuite/src/HTTPSTestServer.cpp#9 $
 //
 // Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
 // and Contributors.
@@ -173,7 +173,10 @@ std::string HTTPSTestServer::handleRequest() const
 		{
 			response.append("Transfer-Encoding: chunked\r\n");
 		}
-		response.append("Connection: Close\r\n");
+		if (_lastRequest.substr(0,15) == "POST /keepAlive")
+			response.append("Connection: keep-alive\r\n");
+		else
+			response.append("Connection: Close\r\n");
 		response.append("\r\n");
 		response.append(body);
 	}

+ 5 - 1
Util/include/Poco/Util/ServerApplication.h

@@ -1,7 +1,7 @@
 //
 // ServerApplication.h
 //
-// $Id: //poco/Main/Util/include/Poco/Util/ServerApplication.h#4 $
+// $Id: //poco/Main/Util/include/Poco/Util/ServerApplication.h#5 $
 //
 // Library: Util
 // Package: Application
@@ -170,7 +170,11 @@ private:
 	};
 	static BOOL __stdcall ConsoleCtrlHandler(DWORD ctrlType);
 	static void __stdcall ServiceControlHandler(DWORD control);
+#if defined(POCO_WIN32_UTF8)
+	static void __stdcall ServiceMain(DWORD argc, LPWSTR* argv);
+#else
 	static void __stdcall ServiceMain(DWORD argc, LPTSTR* argv);
+#endif
 
 	bool hasConsole();
 	bool isService();

+ 10 - 3
Util/include/Poco/Util/WinService.h

@@ -1,7 +1,7 @@
 //
 // WinService.h
 //
-// $Id: //poco/Main/Util/include/Poco/Util/WinService.h#2 $
+// $Id: //poco/Main/Util/include/Poco/Util/WinService.h#3 $
 //
 // Library: Util
 // Package: Windows
@@ -44,6 +44,13 @@
 #include <windows.h>
 
 
+#if defined(POCO_WIN32_UTF8)
+#define POCO_LPQUERY_SERVICE_CONFIG LPQUERY_SERVICE_CONFIGW
+#else
+#define POCO_LPQUERY_SERVICE_CONFIG LPQUERY_SERVICE_CONFIGA
+#endif
+
+
 namespace Poco {
 namespace Util {
 
@@ -128,8 +135,8 @@ private:
 	void open() const;
 	bool tryOpen() const;
 	void close() const;
-	LPQUERY_SERVICE_CONFIG config() const;
-	
+	POCO_LPQUERY_SERVICE_CONFIG config() const;
+
 	WinService();
 	WinService(const WinService&);
 	WinService& operator = (const WinService&);

+ 12 - 4
Util/src/ServerApplication.cpp

@@ -1,7 +1,7 @@
 //
 // ServerApplication.cpp
 //
-// $Id: //poco/Main/Util/src/ServerApplication.cpp#19 $
+// $Id: //poco/Main/Util/src/ServerApplication.cpp#20 $
 //
 // Library: Util
 // Package: Application
@@ -146,7 +146,11 @@ void ServerApplication::ServiceControlHandler(DWORD control)
 }
 
 
+#if defined(POCO_WIN32_UTF8)
+void ServerApplication::ServiceMain(DWORD argc, LPWSTR* argv)
+#else
 void ServerApplication::ServiceMain(DWORD argc, LPTSTR* argv)
+#endif
 {
 	ServerApplication& app = static_cast<ServerApplication&>(Application::instance());
 
@@ -302,17 +306,21 @@ int ServerApplication::run(int argc, wchar_t** argv)
 
 bool ServerApplication::isService()
 {
-	SERVICE_TABLE_ENTRY svcDispatchTable[2];
 #if defined(POCO_WIN32_UTF8)
+	SERVICE_TABLE_ENTRYW svcDispatchTable[2];
 	svcDispatchTable[0].lpServiceName = L"";
+	svcDispatchTable[0].lpServiceProc = ServiceMain;
+	svcDispatchTable[1].lpServiceName = NULL;
+	svcDispatchTable[1].lpServiceProc = NULL; 
+	return StartServiceCtrlDispatcherW(svcDispatchTable) != 0; 
 #else
+	SERVICE_TABLE_ENTRY svcDispatchTable[2];
 	svcDispatchTable[0].lpServiceName = "";
-#endif
 	svcDispatchTable[0].lpServiceProc = ServiceMain;
 	svcDispatchTable[1].lpServiceName = NULL;
 	svcDispatchTable[1].lpServiceProc = NULL; 
-
 	return StartServiceCtrlDispatcher(svcDispatchTable) != 0; 
+#endif
 }
 
 

+ 4 - 4
Util/src/WinRegistryKey.cpp

@@ -1,7 +1,7 @@
 //
 // WinRegistryKey.cpp
 //
-// $Id: //poco/Main/Util/src/WinRegistryKey.cpp#11 $
+// $Id: //poco/Main/Util/src/WinRegistryKey.cpp#12 $
 //
 // Library: Util
 // Package: Windows
@@ -159,7 +159,7 @@ std::string WinRegistryKey::getStringExpand(const std::string& name)
 #if defined(POCO_WIN32_UTF8)
 	std::wstring uname;
 	Poco::UnicodeConverter::toUTF16(name, uname);
-	if (RegQueryValueEx(_hKey, uname.c_str(), NULL, &type, NULL, &size) != ERROR_SUCCESS || type != REG_SZ && type != REG_EXPAND_SZ)
+	if (RegQueryValueExW(_hKey, uname.c_str(), NULL, &type, NULL, &size) != ERROR_SUCCESS || type != REG_SZ && type != REG_EXPAND_SZ)
 		throw NotFoundException(key(name));
 	if (size > 0)
 	{
@@ -168,7 +168,7 @@ std::string WinRegistryKey::getStringExpand(const std::string& name)
 		RegQueryValueExW(_hKey, uname.c_str(), NULL, NULL, (BYTE*) buffer, &size);
 		buffer[len] = 0;
 		wchar_t temp;
-		DWORD expSize = ExpandEnvironmentStrings(buffer, &temp, 1);	
+		DWORD expSize = ExpandEnvironmentStringsW(buffer, &temp, 1);	
 		wchar_t* expBuffer = new wchar_t[expSize];
 		ExpandEnvironmentStringsW(buffer, expBuffer, expSize);
 		std::string result;
@@ -320,7 +320,7 @@ void WinRegistryKey::open()
 #if defined(POCO_WIN32_UTF8)
 		std::wstring usubKey;
 		Poco::UnicodeConverter::toUTF16(_subKey, usubKey);
-		if (RegCreateKeyEx(_hRootKey, usubKey.c_str(), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE, NULL, &_hKey, NULL) != ERROR_SUCCESS)
+		if (RegCreateKeyExW(_hRootKey, usubKey.c_str(), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE, NULL, &_hKey, NULL) != ERROR_SUCCESS)
 			throw SystemException("Cannot open registry key: ", key());
 #else
 		if (RegCreateKeyEx(_hRootKey, _subKey.c_str(), 0, NULL, REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE, NULL, &_hKey, NULL) != ERROR_SUCCESS)

+ 13 - 9
Util/src/WinService.cpp

@@ -1,7 +1,7 @@
 //
 // WinService.cpp
 //
-// $Id: //poco/Main/Util/src/WinService.cpp#9 $
+// $Id: //poco/Main/Util/src/WinService.cpp#10 $
 //
 // Library: Util
 // Package: Windows
@@ -79,7 +79,7 @@ const std::string& WinService::name() const
 
 std::string WinService::displayName() const
 {
-	LPQUERY_SERVICE_CONFIG pSvcConfig = config();
+	POCO_LPQUERY_SERVICE_CONFIG pSvcConfig = config();
 #if defined(POCO_WIN32_UTF8)
 	std::wstring udispName(pSvcConfig->lpDisplayName);
 	std::string dispName;
@@ -94,7 +94,7 @@ std::string WinService::displayName() const
 
 std::string WinService::path() const
 {
-	LPQUERY_SERVICE_CONFIG pSvcConfig = config();
+	POCO_LPQUERY_SERVICE_CONFIG pSvcConfig = config();
 #if defined(POCO_WIN32_UTF8)
 	std::wstring upath(pSvcConfig->lpBinaryPathName);
 	std::string path;
@@ -117,7 +117,7 @@ void WinService::registerService(const std::string& path, const std::string& dis
 	Poco::UnicodeConverter::toUTF16(displayName, udisplayName);
 	std::wstring upath;
 	Poco::UnicodeConverter::toUTF16(path, upath);
-	_svcHandle = CreateService(
+	_svcHandle = CreateServiceW(
 		_scmHandle,
 		uname.c_str(),
 		udisplayName.c_str(), 
@@ -232,7 +232,7 @@ void WinService::setStartup(WinService::Startup startup)
 	
 WinService::Startup WinService::getStartup() const
 {
-	LPQUERY_SERVICE_CONFIG pSvcConfig = config();
+	POCO_LPQUERY_SERVICE_CONFIG pSvcConfig = config();
 	Startup result;
 	switch (pSvcConfig->dwStartType)
 	{
@@ -268,7 +268,7 @@ bool WinService::tryOpen() const
 #if defined(POCO_WIN32_UTF8)
 	std::wstring uname;
 	Poco::UnicodeConverter::toUTF16(_name, uname);
-	_svcHandle = OpenService(_scmHandle, uname.c_str(), SERVICE_ALL_ACCESS);
+	_svcHandle = OpenServiceW(_scmHandle, uname.c_str(), SERVICE_ALL_ACCESS);
 #else
 	_svcHandle = OpenService(_scmHandle, _name.c_str(), SERVICE_ALL_ACCESS);
 #endif
@@ -285,22 +285,26 @@ void WinService::close() const
 }
 
 
-LPQUERY_SERVICE_CONFIG WinService::config() const
+POCO_LPQUERY_SERVICE_CONFIG WinService::config() const
 {
 	open();
 	int size = 4096;
 	DWORD bytesNeeded;
-	LPQUERY_SERVICE_CONFIG pSvcConfig = (LPQUERY_SERVICE_CONFIG) LocalAlloc(LPTR, size);
+	POCO_LPQUERY_SERVICE_CONFIG pSvcConfig = (POCO_LPQUERY_SERVICE_CONFIG) LocalAlloc(LPTR, size);
 	if (!pSvcConfig) throw OutOfMemoryException("cannot allocate service config buffer");
 	try
 	{
+#if defined(POCO_WIN32_UTF8)
+		while (!QueryServiceConfigW(_svcHandle, pSvcConfig, size, &bytesNeeded))
+#else
 		while (!QueryServiceConfig(_svcHandle, pSvcConfig, size, &bytesNeeded))
+#endif
 		{
 			if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
 			{
 				LocalFree(pSvcConfig);
 				size = bytesNeeded;
-				pSvcConfig = (LPQUERY_SERVICE_CONFIG) LocalAlloc(LPTR, size);
+				pSvcConfig = (POCO_LPQUERY_SERVICE_CONFIG) LocalAlloc(LPTR, size);
 			}
 			else throw SystemException("cannot query service configuration", _name);
 		}

+ 1 - 1
XML/include/Poco/DOM/ElementsByTagNameList.h

@@ -1,7 +1,7 @@
 //
 // ElementsByTagNameList.h
 //
-// $Id: //poco/Main/XML/include/Poco/DOM/ElementsByTagNameList.h#2 $
+// $Id: //poco/Main/XML/include/Poco/DOM/ElementsByTagNameList.h#4 $
 //
 // Library: XML
 // Package: DOM

+ 2 - 1
XML/src/ElementsByTagNameList.cpp

@@ -1,7 +1,7 @@
 //
 // ElementsByTagNameList.cpp
 //
-// $Id: //poco/Main/XML/src/ElementsByTagNameList.cpp#10 $
+// $Id: //poco/Main/XML/src/ElementsByTagNameList.cpp#11 $
 //
 // Library: XML
 // Package: DOM
@@ -37,6 +37,7 @@
 #include "Poco/DOM/ElementsByTagNameList.h"
 #include "Poco/DOM/Node.h"
 #include "Poco/DOM/Document.h"
+#include <climits>
 
 
 namespace Poco {