fixed various bugs (see SF tracker)

This commit is contained in:
Guenter Obiltschnig
2008-09-16 17:26:28 +00:00
parent 5b26a62961
commit 57762a2cfc
19 changed files with 97 additions and 28 deletions

View File

@@ -164,6 +164,7 @@
Name="VCCustomBuildTool"/> Name="VCCustomBuildTool"/>
<Tool <Tool
Name="VCLibrarianTool" Name="VCLibrarianTool"
AdditionalDependencies="ws2_32.lib"
OutputFile="..\lib\Poco$(ProjectName)mtd.lib"/> OutputFile="..\lib\Poco$(ProjectName)mtd.lib"/>
<Tool <Tool
Name="VCMIDLTool"/> Name="VCMIDLTool"/>
@@ -217,6 +218,7 @@
Name="VCCustomBuildTool"/> Name="VCCustomBuildTool"/>
<Tool <Tool
Name="VCLibrarianTool" Name="VCLibrarianTool"
AdditionalDependencies="ws2_32.lib"
OutputFile="..\lib\Poco$(ProjectName)mt.lib"/> OutputFile="..\lib\Poco$(ProjectName)mt.lib"/>
<Tool <Tool
Name="VCMIDLTool"/> Name="VCMIDLTool"/>

View File

@@ -256,6 +256,7 @@
/> />
<Tool <Tool
Name="VCLibrarianTool" Name="VCLibrarianTool"
AdditionalDependencies="ws2_32.lib"
OutputFile="..\lib\Poco$(ProjectName)mt.lib" OutputFile="..\lib\Poco$(ProjectName)mt.lib"
/> />
<Tool <Tool
@@ -327,6 +328,7 @@
/> />
<Tool <Tool
Name="VCLibrarianTool" Name="VCLibrarianTool"
AdditionalDependencies="ws2_32.lib"
OutputFile="..\lib\Poco$(ProjectName)mtd.lib" OutputFile="..\lib\Poco$(ProjectName)mtd.lib"
/> />
<Tool <Tool

View File

@@ -249,6 +249,7 @@
/> />
<Tool <Tool
Name="VCLibrarianTool" Name="VCLibrarianTool"
AdditionalDependencies="ws2_32.lib"
OutputFile="..\lib\Poco$(ProjectName)mt.lib" OutputFile="..\lib\Poco$(ProjectName)mt.lib"
/> />
<Tool <Tool
@@ -318,6 +319,7 @@
/> />
<Tool <Tool
Name="VCLibrarianTool" Name="VCLibrarianTool"
AdditionalDependencies="ws2_32.lib"
OutputFile="..\lib\Poco$(ProjectName)mtd.lib" OutputFile="..\lib\Poco$(ProjectName)mtd.lib"
/> />
<Tool <Tool

View File

@@ -89,7 +89,7 @@ public:
typedef typename Bucket::iterator BucketIterator; typedef typename Bucket::iterator BucketIterator;
typedef typename BucketVec::iterator BucketVecIterator; typedef typename BucketVec::iterator BucketVecIterator;
class ConstIterator class ConstIterator: public std::iterator<std::forward_iterator_tag, Value>
{ {
public: public:
ConstIterator() ConstIterator()

View File

@@ -115,7 +115,10 @@ void AsyncChannel::close()
{ {
while (!_queue.empty()) Thread::sleep(100); while (!_queue.empty()) Thread::sleep(100);
do { _queue.wakeUpAll(); } do
{
_queue.wakeUpAll();
}
while (!_thread.tryJoin(100)); while (!_thread.tryJoin(100));
} }
} }

View File

@@ -166,6 +166,7 @@
Name="VCCustomBuildTool"/> Name="VCCustomBuildTool"/>
<Tool <Tool
Name="VCLibrarianTool" Name="VCLibrarianTool"
AdditionalDependencies="ws2_32.lib"
OutputFile="..\lib\Poco$(ProjectName)mtd.lib"/> OutputFile="..\lib\Poco$(ProjectName)mtd.lib"/>
<Tool <Tool
Name="VCMIDLTool"/> Name="VCMIDLTool"/>
@@ -219,6 +220,7 @@
Name="VCCustomBuildTool"/> Name="VCCustomBuildTool"/>
<Tool <Tool
Name="VCLibrarianTool" Name="VCLibrarianTool"
AdditionalDependencies="ws2_32.lib"
OutputFile="..\lib\Poco$(ProjectName)mt.lib"/> OutputFile="..\lib\Poco$(ProjectName)mt.lib"/>
<Tool <Tool
Name="VCMIDLTool"/> Name="VCMIDLTool"/>

View File

@@ -258,6 +258,7 @@
/> />
<Tool <Tool
Name="VCLibrarianTool" Name="VCLibrarianTool"
AdditionalDependencies="ws2_32.lib"
OutputFile="..\lib\Poco$(ProjectName)mt.lib" OutputFile="..\lib\Poco$(ProjectName)mt.lib"
/> />
<Tool <Tool
@@ -329,6 +330,7 @@
/> />
<Tool <Tool
Name="VCLibrarianTool" Name="VCLibrarianTool"
AdditionalDependencies="ws2_32.lib"
OutputFile="..\lib\Poco$(ProjectName)mtd.lib" OutputFile="..\lib\Poco$(ProjectName)mtd.lib"
/> />
<Tool <Tool

View File

@@ -249,6 +249,7 @@
/> />
<Tool <Tool
Name="VCLibrarianTool" Name="VCLibrarianTool"
AdditionalDependencies="ws2_32.lib"
OutputFile="..\lib\Poco$(ProjectName)mt.lib" OutputFile="..\lib\Poco$(ProjectName)mt.lib"
/> />
<Tool <Tool
@@ -318,6 +319,7 @@
/> />
<Tool <Tool
Name="VCLibrarianTool" Name="VCLibrarianTool"
AdditionalDependencies="ws2_32.lib"
OutputFile="..\lib\Poco$(ProjectName)mtd.lib" OutputFile="..\lib\Poco$(ProjectName)mtd.lib"
/> />
<Tool <Tool

View File

@@ -1,7 +1,7 @@
// //
// HTTPCookie.h // HTTPCookie.h
// //
// $Id: //poco/svn/Net/include/Poco/Net/HTTPCookie.h#2 $ // $Id: //poco/1.3/Net/include/Poco/Net/HTTPCookie.h#1 $
// //
// Library: Net // Library: Net
// Package: HTTP // Package: HTTP
@@ -157,6 +157,12 @@ public:
/// Returns the maximum age in seconds for /// Returns the maximum age in seconds for
/// the cookie. /// the cookie.
void setHttpOnly(bool flag = true);
/// Sets the HttpOnly flag for the cookie.
bool getHttpOnly() const;
/// Returns true iff the cookie's HttpOnly flag is set.
std::string toString() const; std::string toString() const;
/// Returns a string representation of the cookie, /// Returns a string representation of the cookie,
/// suitable for use in a Set-Cookie header. /// suitable for use in a Set-Cookie header.
@@ -170,6 +176,7 @@ private:
std::string _path; std::string _path;
bool _secure; bool _secure;
int _maxAge; int _maxAge;
bool _httpOnly;
}; };
@@ -224,6 +231,12 @@ inline int HTTPCookie::getMaxAge() const
} }
inline bool HTTPCookie::getHttpOnly() const
{
return _httpOnly;
}
} } // namespace Poco::Net } } // namespace Poco::Net

View File

@@ -124,6 +124,7 @@ void HTMLForm::addPart(const std::string& name, PartSource* pSource)
void HTMLForm::load(const HTTPRequest& request, std::istream& requestBody, PartHandler& handler) void HTMLForm::load(const HTTPRequest& request, std::istream& requestBody, PartHandler& handler)
{ {
clear();
if (request.getMethod() == HTTPRequest::HTTP_POST) if (request.getMethod() == HTTPRequest::HTTP_POST)
{ {
std::string mediaType; std::string mediaType;

View File

@@ -1,7 +1,7 @@
// //
// HTTPCookie.cpp // HTTPCookie.cpp
// //
// $Id: //poco/svn/Net/src/HTTPCookie.cpp#2 $ // $Id: //poco/1.3/Net/src/HTTPCookie.cpp#2 $
// //
// Library: Net // Library: Net
// Package: HTTP // Package: HTTP
@@ -63,7 +63,8 @@ namespace Net {
HTTPCookie::HTTPCookie(): HTTPCookie::HTTPCookie():
_version(0), _version(0),
_secure(false), _secure(false),
_maxAge(-1) _maxAge(-1),
_httpOnly(false)
{ {
} }
@@ -72,7 +73,8 @@ HTTPCookie::HTTPCookie(const std::string& name):
_version(0), _version(0),
_name(name), _name(name),
_secure(false), _secure(false),
_maxAge(-1) _maxAge(-1),
_httpOnly(false)
{ {
} }
@@ -80,7 +82,8 @@ HTTPCookie::HTTPCookie(const std::string& name):
HTTPCookie::HTTPCookie(const NameValueCollection& nvc): HTTPCookie::HTTPCookie(const NameValueCollection& nvc):
_version(0), _version(0),
_secure(false), _secure(false),
_maxAge(-1) _maxAge(-1),
_httpOnly(false)
{ {
for (NameValueCollection::ConstIterator it = nvc.begin(); it != nvc.end(); ++it) for (NameValueCollection::ConstIterator it = nvc.begin(); it != nvc.end(); ++it)
{ {
@@ -117,6 +120,10 @@ HTTPCookie::HTTPCookie(const NameValueCollection& nvc):
{ {
setVersion(NumberParser::parse(value)); setVersion(NumberParser::parse(value));
} }
else if (icompare(name, "HttpOnly") == 0)
{
setHttpOnly(true);
}
else else
{ {
setName(name); setName(name);
@@ -131,7 +138,8 @@ HTTPCookie::HTTPCookie(const std::string& name, const std::string& value):
_name(name), _name(name),
_value(value), _value(value),
_secure(false), _secure(false),
_maxAge(-1) _maxAge(-1),
_httpOnly(false)
{ {
} }
@@ -144,7 +152,8 @@ HTTPCookie::HTTPCookie(const HTTPCookie& cookie):
_domain(cookie._domain), _domain(cookie._domain),
_path(cookie._path), _path(cookie._path),
_secure(cookie._secure), _secure(cookie._secure),
_maxAge(cookie._maxAge) _maxAge(cookie._maxAge),
_httpOnly(cookie._httpOnly)
{ {
} }
@@ -158,14 +167,15 @@ HTTPCookie& HTTPCookie::operator = (const HTTPCookie& cookie)
{ {
if (&cookie != this) if (&cookie != this)
{ {
_version = cookie._version; _version = cookie._version;
_name = cookie._name; _name = cookie._name;
_value = cookie._value; _value = cookie._value;
_comment = cookie._comment; _comment = cookie._comment;
_domain = cookie._domain; _domain = cookie._domain;
_path = cookie._path; _path = cookie._path;
_secure = cookie._secure; _secure = cookie._secure;
_maxAge = cookie._maxAge; _maxAge = cookie._maxAge;
_httpOnly = cookie._httpOnly;
} }
return *this; return *this;
} }
@@ -219,6 +229,12 @@ void HTTPCookie::setMaxAge(int maxAge)
} }
void HTTPCookie::setHttpOnly(bool flag)
{
_httpOnly = flag;
}
std::string HTTPCookie::toString() const std::string HTTPCookie::toString() const
{ {
std::string result(_name); std::string result(_name);
@@ -248,6 +264,10 @@ std::string HTTPCookie::toString() const
{ {
result.append("; secure"); result.append("; secure");
} }
if (_httpOnly)
{
result.append("; HttpOnly");
}
} }
else else
{ {
@@ -283,6 +303,10 @@ std::string HTTPCookie::toString() const
{ {
result.append("; secure"); result.append("; secure");
} }
if (_httpOnly)
{
result.append("; HttpOnly");
}
result.append("; Version=\"1\""); result.append("; Version=\"1\"");
} }
return result; return result;

View File

@@ -1,7 +1,7 @@
// //
// HTTPCookieTest.cpp // HTTPCookieTest.cpp
// //
// $Id: //poco/svn/Net/testsuite/src/HTTPCookieTest.cpp#2 $ // $Id: //poco/1.3/Net/testsuite/src/HTTPCookieTest.cpp#1 $
// //
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
@@ -63,6 +63,9 @@ void HTTPCookieTest::testCookie()
assert (cookie.toString() == "name=value; domain=appinf.com; path=/"); assert (cookie.toString() == "name=value; domain=appinf.com; path=/");
cookie.setSecure(true); cookie.setSecure(true);
assert (cookie.toString() == "name=value; domain=appinf.com; path=/; secure"); assert (cookie.toString() == "name=value; domain=appinf.com; path=/; secure");
cookie.setHttpOnly(true);
assert (cookie.toString() == "name=value; domain=appinf.com; path=/; secure; HttpOnly");
cookie.setHttpOnly(false);
cookie.setVersion(1); cookie.setVersion(1);
assert (cookie.toString() == "name=\"value\"; Comment=\"comment\"; Domain=\"appinf.com\"; Path=\"/\"; secure; Version=\"1\""); assert (cookie.toString() == "name=\"value\"; Comment=\"comment\"; Domain=\"appinf.com\"; Path=\"/\"; secure; Version=\"1\"");
@@ -70,6 +73,9 @@ void HTTPCookieTest::testCookie()
cookie.setSecure(false); cookie.setSecure(false);
cookie.setMaxAge(100); cookie.setMaxAge(100);
assert (cookie.toString() == "name=\"value\"; Comment=\"comment\"; Domain=\"appinf.com\"; Path=\"/\"; Max-Age=\"100\"; Version=\"1\""); assert (cookie.toString() == "name=\"value\"; Comment=\"comment\"; Domain=\"appinf.com\"; Path=\"/\"; Max-Age=\"100\"; Version=\"1\"");
cookie.setHttpOnly(true);
assert (cookie.toString() == "name=\"value\"; Comment=\"comment\"; Domain=\"appinf.com\"; Path=\"/\"; Max-Age=\"100\"; HttpOnly; Version=\"1\"");
} }

View File

@@ -166,6 +166,7 @@
Name="VCCustomBuildTool"/> Name="VCCustomBuildTool"/>
<Tool <Tool
Name="VCLibrarianTool" Name="VCLibrarianTool"
AdditionalDependencies="ws2_32.lib"
OutputFile="..\lib\PocoNetSSLmtd.lib"/> OutputFile="..\lib\PocoNetSSLmtd.lib"/>
<Tool <Tool
Name="VCMIDLTool"/> Name="VCMIDLTool"/>
@@ -219,6 +220,7 @@
Name="VCCustomBuildTool"/> Name="VCCustomBuildTool"/>
<Tool <Tool
Name="VCLibrarianTool" Name="VCLibrarianTool"
AdditionalDependencies="ws2_32.lib"
OutputFile="..\lib\PocoNetSSLmt.lib"/> OutputFile="..\lib\PocoNetSSLmt.lib"/>
<Tool <Tool
Name="VCMIDLTool"/> Name="VCMIDLTool"/>

View File

@@ -254,6 +254,7 @@
/> />
<Tool <Tool
Name="VCLibrarianTool" Name="VCLibrarianTool"
AdditionalDependencies="ws2_32.lib"
OutputFile="..\lib\PocoNetSSLmtd.lib" OutputFile="..\lib\PocoNetSSLmtd.lib"
/> />
<Tool <Tool
@@ -329,6 +330,7 @@
/> />
<Tool <Tool
Name="VCLibrarianTool" Name="VCLibrarianTool"
AdditionalDependencies="ws2_32.lib"
OutputFile="..\lib\PocoNetSSLmt.lib" OutputFile="..\lib\PocoNetSSLmt.lib"
/> />
<Tool <Tool

View File

@@ -245,6 +245,7 @@
/> />
<Tool <Tool
Name="VCLibrarianTool" Name="VCLibrarianTool"
AdditionalDependencies="ws2_32.lib"
OutputFile="..\lib\PocoNetSSLmtd.lib" OutputFile="..\lib\PocoNetSSLmtd.lib"
/> />
<Tool <Tool
@@ -318,6 +319,7 @@
/> />
<Tool <Tool
Name="VCLibrarianTool" Name="VCLibrarianTool"
AdditionalDependencies="ws2_32.lib"
OutputFile="..\lib\PocoNetSSLmt.lib" OutputFile="..\lib\PocoNetSSLmt.lib"
/> />
<Tool <Tool

View File

@@ -1,7 +1,7 @@
// //
// XMLString.h // XMLString.h
// //
// $Id: //poco/svn/XML/include/Poco/XML/XMLString.h#2 $ // $Id: //poco/1.3/XML/include/Poco/XML/XMLString.h#1 $
// //
// Library: XML // Library: XML
// Package: XML // Package: XML
@@ -76,6 +76,8 @@ namespace XML {
/// Converts an UTF-8 encoded string into an /// Converts an UTF-8 encoded string into an
/// XMLString /// XMLString
#define XML_LIT(lit) L##lit
#elif defined(XML_UNICODE) #elif defined(XML_UNICODE)
// not supported - leave XMLString undefined // not supported - leave XMLString undefined
@@ -96,6 +98,8 @@ namespace XML {
return str; return str;
} }
#define XML_LIT(lit) lit
#endif #endif

View File

@@ -1,7 +1,7 @@
// //
// AttributesImpl.cpp // AttributesImpl.cpp
// //
// $Id: //poco/svn/XML/src/AttributesImpl.cpp#3 $ // $Id: //poco/1.3/XML/src/AttributesImpl.cpp#2 $
// //
// Library: XML // Library: XML
// Package: SAX // Package: SAX
@@ -44,14 +44,14 @@ namespace XML {
AttributesImpl::AttributesImpl() AttributesImpl::AttributesImpl()
{ {
_empty.specified = false; _empty.specified = false;
_empty.type = "CDATA"; _empty.type = XML_LIT("CDATA");
} }
AttributesImpl::AttributesImpl(const Attributes& attributes) AttributesImpl::AttributesImpl(const Attributes& attributes)
{ {
_empty.specified = false; _empty.specified = false;
_empty.type = "CDATA"; _empty.type = XML_LIT("CDATA");
setAttributes(attributes); setAttributes(attributes);
} }

View File

@@ -1,7 +1,7 @@
// //
// NamespaceStrategy.cpp // NamespaceStrategy.cpp
// //
// $Id: //poco/svn/XML/src/NamespaceStrategy.cpp#3 $ // $Id: //poco/1.3/XML/src/NamespaceStrategy.cpp#2 $
// //
// Library: XML // Library: XML
// Package: XML // Package: XML
@@ -82,13 +82,13 @@ void NamespaceStrategy::splitName(const XMLChar* qname, XMLString& uri, XMLStrin
if (*p) if (*p)
prefix.assign(++p); prefix.assign(++p);
else else
prefix.assign(""); prefix.assign(XML_LIT(""));
} }
else else
{ {
uri.assign(""); uri.assign(XML_LIT(""));
localName = qname; localName = qname;
prefix.assign(""); prefix.assign(XML_LIT(""));
} }
} }

View File

@@ -1,7 +1,7 @@
// //
// ParserEngine.cpp // ParserEngine.cpp
// //
// $Id: //poco/svn/XML/src/ParserEngine.cpp#3 $ // $Id: //poco/1.3/XML/src/ParserEngine.cpp#4 $
// //
// Library: XML // Library: XML
// Package: XML // Package: XML
@@ -720,7 +720,7 @@ int ParserEngine::handleUnknownEncoding(void* encodingHandlerData, const XML_Cha
if (it != pThis->_encodings.end()) if (it != pThis->_encodings.end())
knownEncoding = it->second; knownEncoding = it->second;
else else
knownEncoding = Poco::TextEncoding::find(encoding); knownEncoding = Poco::TextEncoding::find(fromXMLString(encoding));
if (knownEncoding) if (knownEncoding)
{ {