mirror of
https://github.com/stefanocasazza/ULib.git
synced 2025-09-28 19:05:55 +08:00
bug fixing
This commit is contained in:
parent
6f780f99e1
commit
488927dd47
|
@ -3994,7 +3994,7 @@ static void GET_get_config()
|
||||||
|
|
||||||
UHTTP::mime_index = U_know;
|
UHTTP::mime_index = U_know;
|
||||||
|
|
||||||
if (cfg.processData())
|
if (cfg.processData(false))
|
||||||
{
|
{
|
||||||
_body = cfg.getData();
|
_body = cfg.getData();
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ public:
|
||||||
|
|
||||||
// EXT
|
// EXT
|
||||||
|
|
||||||
bool processData();
|
bool processData(bool bload);
|
||||||
|
|
||||||
UString getData() const { return data; }
|
UString getData() const { return data; }
|
||||||
void setData(const UString& _data, bool _preprocessing) { data = _data; preprocessing = _preprocessing; }
|
void setData(const UString& _data, bool _preprocessing) { data = _data; preprocessing = _preprocessing; }
|
||||||
|
|
|
@ -1002,6 +1002,8 @@ protected:
|
||||||
U_INTERNAL_ASSERT(invariant())
|
U_INTERNAL_ASSERT(invariant())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setFromData(const char** ptr, uint32_t sz, unsigned char delim);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// mutable
|
// mutable
|
||||||
UStringRep* rep;
|
UStringRep* rep;
|
||||||
|
@ -1765,9 +1767,6 @@ public:
|
||||||
va_end(argp);
|
va_end(argp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setFromData(const char** ptr, uint32_t sz);
|
|
||||||
void setFromData(const char** ptr, uint32_t sz, unsigned char delim);
|
|
||||||
|
|
||||||
void size_adjust() { rep->size_adjust(); }
|
void size_adjust() { rep->size_adjust(); }
|
||||||
void size_adjust_force() { rep->size_adjust_force(); }
|
void size_adjust_force() { rep->size_adjust_force(); }
|
||||||
|
|
||||||
|
@ -1929,6 +1928,9 @@ public:
|
||||||
private:
|
private:
|
||||||
char* __append(uint32_t n);
|
char* __append(uint32_t n);
|
||||||
char* __replace(uint32_t pos, uint32_t n1, uint32_t n2);
|
char* __replace(uint32_t pos, uint32_t n1, uint32_t n2);
|
||||||
|
|
||||||
|
template <class T> friend class UVector;
|
||||||
|
template <class T> friend class UHashMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
// operator ==
|
// operator ==
|
||||||
|
|
|
@ -199,7 +199,8 @@ public:
|
||||||
{
|
{
|
||||||
U_TRACE(0, "UDataSession::getValueVar(%u,%p)", index, &value)
|
U_TRACE(0, "UDataSession::getValueVar(%u,%p)", index, &value)
|
||||||
|
|
||||||
value = vec_var->at(index);
|
if (index < vec_var->size()) value = vec_var->at(index);
|
||||||
|
else value.clear();
|
||||||
|
|
||||||
U_INTERNAL_DUMP("value = %V", value.rep)
|
U_INTERNAL_DUMP("value = %V", value.rep)
|
||||||
}
|
}
|
||||||
|
|
|
@ -435,6 +435,7 @@ public:
|
||||||
// COOKIE
|
// COOKIE
|
||||||
|
|
||||||
static UString* set_cookie;
|
static UString* set_cookie;
|
||||||
|
static uint32_t sid_counter_gen;
|
||||||
static UString* set_cookie_option;
|
static UString* set_cookie_option;
|
||||||
static UString* cgi_cookie_option;
|
static UString* cgi_cookie_option;
|
||||||
|
|
||||||
|
|
|
@ -663,12 +663,23 @@ uint32_t UHashMap<UString>::loadFromData(const char* ptr, uint32_t sz)
|
||||||
|
|
||||||
// U_INTERNAL_DUMP("c = %C", c)
|
// U_INTERNAL_DUMP("c = %C", c)
|
||||||
|
|
||||||
if (c == '"') _key.setFromData(&ptr, sz, '"');
|
if (c == '"')
|
||||||
|
{
|
||||||
|
// NB: check if we have a string null...
|
||||||
|
|
||||||
|
if (*ptr != '"') _key.setFromData(&ptr, _end - ptr, '"');
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++ptr;
|
||||||
|
|
||||||
|
_key.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
--ptr;
|
--ptr;
|
||||||
|
|
||||||
_key.setFromData(&ptr, sz);
|
_key.setFromData(&ptr, _end - ptr, terminator);
|
||||||
}
|
}
|
||||||
|
|
||||||
U_INTERNAL_ASSERT(_key)
|
U_INTERNAL_ASSERT(_key)
|
||||||
|
@ -686,12 +697,23 @@ uint32_t UHashMap<UString>::loadFromData(const char* ptr, uint32_t sz)
|
||||||
|
|
||||||
// U_INTERNAL_DUMP("c = %C", c)
|
// U_INTERNAL_DUMP("c = %C", c)
|
||||||
|
|
||||||
if (c == '"') str.setFromData(&ptr, sz, '"');
|
if (c == '"')
|
||||||
|
{
|
||||||
|
// NB: check if we have a string null...
|
||||||
|
|
||||||
|
if (*ptr != '"') str.setFromData(&ptr, _end - ptr, '"');
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++ptr;
|
||||||
|
|
||||||
|
str.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
--ptr;
|
--ptr;
|
||||||
|
|
||||||
str.setFromData(&ptr, sz);
|
str.setFromData(&ptr, _end - ptr, terminator);
|
||||||
}
|
}
|
||||||
|
|
||||||
U_INTERNAL_ASSERT(str)
|
U_INTERNAL_ASSERT(str)
|
||||||
|
@ -700,9 +722,9 @@ uint32_t UHashMap<UString>::loadFromData(const char* ptr, uint32_t sz)
|
||||||
insert(_key, str);
|
insert(_key, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
U_INTERNAL_DUMP("ptr-_start = %lu", ptr-_start)
|
U_INTERNAL_DUMP("ptr - _start = %lu", ptr - _start)
|
||||||
|
|
||||||
U_INTERNAL_ASSERT((ptr-_start) <= sz)
|
U_INTERNAL_ASSERT((ptr - _start) <= sz)
|
||||||
|
|
||||||
sz = ptr - _start;
|
sz = ptr - _start;
|
||||||
|
|
||||||
|
|
|
@ -1023,20 +1023,31 @@ uint32_t UVector<UString>::loadFromData(const char* ptr, uint32_t sz)
|
||||||
|
|
||||||
// U_INTERNAL_DUMP("c = %C", c)
|
// U_INTERNAL_DUMP("c = %C", c)
|
||||||
|
|
||||||
if (c == '"') str.setFromData(&ptr, sz, '"');
|
if (c == '"')
|
||||||
|
{
|
||||||
|
// NB: check if we have a string null...
|
||||||
|
|
||||||
|
if (*ptr != '"') str.setFromData(&ptr, _end - ptr, '"');
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++ptr;
|
||||||
|
|
||||||
|
str.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
--ptr;
|
--ptr;
|
||||||
|
|
||||||
str.setFromData(&ptr, sz);
|
str.setFromData(&ptr, _end - ptr, terminator);
|
||||||
}
|
}
|
||||||
|
|
||||||
push(str);
|
push(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
U_INTERNAL_DUMP("ptr-_start = %lu", ptr-_start)
|
U_INTERNAL_DUMP("ptr - _start = %lu", ptr - _start)
|
||||||
|
|
||||||
U_INTERNAL_ASSERT((ptr-_start) <= sz)
|
U_INTERNAL_ASSERT((ptr - _start) <= sz)
|
||||||
|
|
||||||
sz = ptr - _start;
|
sz = ptr - _start;
|
||||||
|
|
||||||
|
|
|
@ -49,14 +49,12 @@ UFileConfig::UFileConfig(const UString& _data, bool _preprocessing) : data(_data
|
||||||
preprocessing = _preprocessing;
|
preprocessing = _preprocessing;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UFileConfig::processData()
|
bool UFileConfig::processData(bool bload)
|
||||||
{
|
{
|
||||||
U_TRACE(0, "UFileConfig::processData()")
|
U_TRACE(0, "UFileConfig::processData(%b)", bload)
|
||||||
|
|
||||||
U_CHECK_MEMORY
|
U_CHECK_MEMORY
|
||||||
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
// manage if we need preprocessing...
|
// manage if we need preprocessing...
|
||||||
|
|
||||||
#if defined(HAVE_CPP) || defined(HAVE_MCPP)
|
#if defined(HAVE_CPP) || defined(HAVE_MCPP)
|
||||||
|
@ -127,6 +125,7 @@ bool UFileConfig::processData()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (data.empty()) U_RETURN(false);
|
if (data.empty()) U_RETURN(false);
|
||||||
|
if (bload == false) U_RETURN(true);
|
||||||
|
|
||||||
_end = data.end();
|
_end = data.end();
|
||||||
_start = data.data();
|
_start = data.data();
|
||||||
|
@ -134,28 +133,37 @@ bool UFileConfig::processData()
|
||||||
|
|
||||||
if (UFile::isPath())
|
if (UFile::isPath())
|
||||||
{
|
{
|
||||||
// -------------------------------------------------------------
|
//------------ -------------------------------------------------------------
|
||||||
// Loads configuration information from the file.
|
// Loads configuration information from the file. The file type is
|
||||||
// The file type is determined by the file extension.
|
// determined by the file extension. The following extensions are supported:
|
||||||
// The following extensions are supported:
|
// -------------------------------------------------------------------------
|
||||||
// -------------------------------------------------------------
|
|
||||||
// .properties - properties file (JAVA Properties)
|
|
||||||
// .ini - initialization file (Windows INI)
|
// .ini - initialization file (Windows INI)
|
||||||
// -------------------------------------------------------------
|
// .properties - properties file (JAVA Properties)
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
UString suffix = UFile::getSuffix();
|
UString suffix = UFile::getSuffix();
|
||||||
|
|
||||||
if (suffix)
|
if (suffix)
|
||||||
{
|
{
|
||||||
if (suffix.equal(U_CONSTANT_TO_PARAM("ini"))) { result = loadINI(); goto end; }
|
if (suffix.equal(U_CONSTANT_TO_PARAM("ini")))
|
||||||
else if (suffix.equal(U_CONSTANT_TO_PARAM("properties"))) { result = loadProperties(); goto end; }
|
{
|
||||||
|
if (loadINI()) U_RETURN(true);
|
||||||
|
|
||||||
|
U_RETURN(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (suffix.equal(U_CONSTANT_TO_PARAM("properties")))
|
||||||
|
{
|
||||||
|
if (loadProperties()) U_RETURN(true);
|
||||||
|
|
||||||
|
U_RETURN(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = loadSection(0, 0);
|
if (loadSection(0, 0)) U_RETURN(true);
|
||||||
|
|
||||||
end:
|
U_RETURN(false);
|
||||||
U_RETURN(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UFileConfig::load()
|
void UFileConfig::load()
|
||||||
|
@ -169,7 +177,7 @@ void UFileConfig::load()
|
||||||
if (UFile::open() &&
|
if (UFile::open() &&
|
||||||
UFile::size() > 0 &&
|
UFile::size() > 0 &&
|
||||||
UFile::memmap(PROT_READ, &data) &&
|
UFile::memmap(PROT_READ, &data) &&
|
||||||
processData())
|
processData(true))
|
||||||
{
|
{
|
||||||
if (UFile::isOpen()) UFile::close();
|
if (UFile::isOpen()) UFile::close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -347,12 +347,13 @@ bool UImapClient::list(const UString& ref, const UString& wild, UVector<ListResp
|
||||||
U_RETURN(false);
|
U_RETURN(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* STATUS command representation
|
/**
|
||||||
typedef struct StatusInfo {
|
* STATUS command representation
|
||||||
long messageCount, recentCount, nextUID, uidValidity, unseenCount;
|
* typedef struct StatusInfo {
|
||||||
bool hasMessageCount, hasRecentCount, hasNextUID, hasUIDValidity, hasUnseenCount;
|
* long messageCount, recentCount, nextUID, uidValidity, unseenCount;
|
||||||
} StatusInfo;
|
* bool hasMessageCount, hasRecentCount, hasNextUID, hasUIDValidity, hasUnseenCount;
|
||||||
*/
|
* } StatusInfo;
|
||||||
|
*/
|
||||||
|
|
||||||
bool UImapClient::status(const UString& mailboxName, StatusInfo& retval, int items)
|
bool UImapClient::status(const UString& mailboxName, StatusInfo& retval, int items)
|
||||||
{
|
{
|
||||||
|
@ -380,35 +381,36 @@ bool UImapClient::status(const UString& mailboxName, StatusInfo& retval, int ite
|
||||||
uint32_t length, i = (ptr2 - ptr1);
|
uint32_t length, i = (ptr2 - ptr1);
|
||||||
|
|
||||||
UString x = buffer.substr(i, end - i);
|
UString x = buffer.substr(i, end - i);
|
||||||
|
|
||||||
UVector<UString> vec(x);
|
UVector<UString> vec(x);
|
||||||
|
|
||||||
for (i = 0, length = vec.size(); i < length; ++i)
|
for (i = 0, length = vec.size(); i < length; ++i)
|
||||||
{
|
{
|
||||||
if (!retval.hasMessageCount &&
|
if (retval.hasMessageCount == false &&
|
||||||
vec[i].equal(U_CONSTANT_TO_PARAM("MESSAGES")))
|
vec[i].equal(U_CONSTANT_TO_PARAM("MESSAGES")))
|
||||||
{
|
{
|
||||||
retval.messageCount = vec[++i].strtol();
|
retval.messageCount = vec[++i].strtol();
|
||||||
retval.hasMessageCount = true;
|
retval.hasMessageCount = true;
|
||||||
}
|
}
|
||||||
else if (!retval.hasRecentCount &&
|
else if (retval.hasRecentCount == false &&
|
||||||
vec[i] == *str_recent)
|
vec[i] == *str_recent)
|
||||||
{
|
{
|
||||||
retval.recentCount = vec[++i].strtol();
|
retval.recentCount = vec[++i].strtol();
|
||||||
retval.hasRecentCount = true;
|
retval.hasRecentCount = true;
|
||||||
}
|
}
|
||||||
else if (!retval.hasNextUID &&
|
else if (retval.hasNextUID == false &&
|
||||||
vec[i] == *str_uidnext)
|
vec[i] == *str_uidnext)
|
||||||
{
|
{
|
||||||
retval.nextUID = vec[++i].strtol();
|
retval.nextUID = vec[++i].strtol();
|
||||||
retval.hasNextUID = true;
|
retval.hasNextUID = true;
|
||||||
}
|
}
|
||||||
else if (!retval.hasUIDValidity &&
|
else if (retval.hasUIDValidity == false &&
|
||||||
vec[i] == *str_uidvalidity)
|
vec[i] == *str_uidvalidity)
|
||||||
{
|
{
|
||||||
retval.uidValidity = vec[++i].strtol();
|
retval.uidValidity = vec[++i].strtol();
|
||||||
retval.hasUIDValidity = true;
|
retval.hasUIDValidity = true;
|
||||||
}
|
}
|
||||||
else if (!retval.hasUnseenCount &&
|
else if (retval.hasUnseenCount == false &&
|
||||||
vec[i] == *str_unseen)
|
vec[i] == *str_unseen)
|
||||||
{
|
{
|
||||||
retval.unseenCount = vec[++i].strtol();
|
retval.unseenCount = vec[++i].strtol();
|
||||||
|
@ -416,7 +418,7 @@ bool UImapClient::status(const UString& mailboxName, StatusInfo& retval, int ite
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
U_ERROR("Unknow tag response for STATUS command, exit..");
|
U_WARNING("Unknow tag response %V for STATUS command", vec[i].rep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -429,28 +431,29 @@ bool UImapClient::status(const UString& mailboxName, StatusInfo& retval, int ite
|
||||||
U_RETURN(false);
|
U_RETURN(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (SELECT | EXAMINE) command representation
|
/**
|
||||||
typedef struct MailboxInfo {
|
* (SELECT | EXAMINE) command representation
|
||||||
bool readWrite;
|
* typedef struct MailboxInfo {
|
||||||
StatusInfo status;
|
* bool readWrite;
|
||||||
int flags, permanentFlags;
|
* StatusInfo status;
|
||||||
bool flagsAvailable, permanentFlagsAvailable, readWriteAvailable;
|
* int flags, permanentFlags;
|
||||||
} MailboxInfo;
|
* bool flagsAvailable, permanentFlagsAvailable, readWriteAvailable;
|
||||||
|
* } MailboxInfo;
|
||||||
enum MailboxFlag {
|
*
|
||||||
SEEN = 1 << 0,
|
* enum MailboxFlag {
|
||||||
ANSWERED = 1 << 1,
|
* SEEN = 1 << 0,
|
||||||
FLAGGED = 1 << 2,
|
* ANSWERED = 1 << 1,
|
||||||
DELETED = 1 << 3,
|
* FLAGGED = 1 << 2,
|
||||||
DRAFT = 1 << 4,
|
* DELETED = 1 << 3,
|
||||||
RECENT = 1 << 5,
|
* DRAFT = 1 << 4,
|
||||||
ASTERISK = 1 << 6,
|
* RECENT = 1 << 5,
|
||||||
MDNSent = 1 << 7,
|
* ASTERISK = 1 << 6,
|
||||||
Junk = 1 << 8,
|
* MDNSent = 1 << 7,
|
||||||
NonJunk = 1 << 9,
|
* Junk = 1 << 8,
|
||||||
Forwarded = 1 << 10
|
* NonJunk = 1 << 9,
|
||||||
};
|
* Forwarded = 1 << 10
|
||||||
*/
|
* };
|
||||||
|
*/
|
||||||
|
|
||||||
U_NO_EXPORT void UImapClient::setFlag(int& _flags, UVector<UString>& vec)
|
U_NO_EXPORT void UImapClient::setFlag(int& _flags, UVector<UString>& vec)
|
||||||
{
|
{
|
||||||
|
|
|
@ -111,7 +111,7 @@ public:
|
||||||
{
|
{
|
||||||
UFileConfig cfg(UStringExt::substitute(usp, U_CONSTANT_TO_PARAM("#include"), U_CONSTANT_TO_PARAM("//#include")), true);
|
UFileConfig cfg(UStringExt::substitute(usp, U_CONSTANT_TO_PARAM("#include"), U_CONSTANT_TO_PARAM("//#include")), true);
|
||||||
|
|
||||||
if (cfg.processData()) usp = UStringExt::substitute(cfg.getData(), U_CONSTANT_TO_PARAM("//#include"), U_CONSTANT_TO_PARAM("#include"));
|
if (cfg.processData(false)) usp = UStringExt::substitute(cfg.getData(), U_CONSTANT_TO_PARAM("//#include"), U_CONSTANT_TO_PARAM("#include"));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
# ifndef DEBUG
|
# ifndef DEBUG
|
||||||
|
|
|
@ -1784,12 +1784,12 @@ void UString::printKeyValue(const char* key, uint32_t keylen, const char* _data,
|
||||||
U_INTERNAL_ASSERT(invariant())
|
U_INTERNAL_ASSERT(invariant())
|
||||||
}
|
}
|
||||||
|
|
||||||
void UString::setFromData(const char** p, uint32_t sz)
|
void UString::setFromData(const char** p, uint32_t sz, unsigned char delim)
|
||||||
{
|
{
|
||||||
U_TRACE(0, "UString::setFromData(%.*S,%u)", sz, *p, sz)
|
U_TRACE(0, "UString::setFromData(%.*S,%u,%C)", sz, *p, sz, delim)
|
||||||
|
|
||||||
U_ASSERT(empty())
|
|
||||||
U_INTERNAL_ASSERT_MAJOR(sz, 0)
|
U_INTERNAL_ASSERT_MAJOR(sz, 0)
|
||||||
|
U_INTERNAL_ASSERT_EQUALS(rep->_length, 0)
|
||||||
|
|
||||||
const char* ptr = *p;
|
const char* ptr = *p;
|
||||||
unsigned char c = *ptr;
|
unsigned char c = *ptr;
|
||||||
|
@ -1799,22 +1799,7 @@ void UString::setFromData(const char** p, uint32_t sz)
|
||||||
|
|
||||||
U_INTERNAL_ASSERT_EQUALS(u__isspace(c), false)
|
U_INTERNAL_ASSERT_EQUALS(u__isspace(c), false)
|
||||||
|
|
||||||
if (LIKELY(c != '@'))
|
if (c == '@')
|
||||||
{
|
|
||||||
do {
|
|
||||||
_append(c);
|
|
||||||
|
|
||||||
if (++ptr >= pend) break;
|
|
||||||
|
|
||||||
c = *ptr;
|
|
||||||
|
|
||||||
if (u__isspace(c)) break;
|
|
||||||
}
|
|
||||||
while (true);
|
|
||||||
|
|
||||||
_append();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
// get content pointed by string 'meta' (that start with '@')
|
// get content pointed by string 'meta' (that start with '@')
|
||||||
|
|
||||||
|
@ -1854,6 +1839,10 @@ void UString::setFromData(const char** p, uint32_t sz)
|
||||||
U_WARNING("open file %S specified in configuration failed", pathname);
|
U_WARNING("open file %S specified in configuration failed", pathname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
U_INTERNAL_DUMP("size = %u, str = %V", size(), rep)
|
||||||
|
|
||||||
|
U_INTERNAL_ASSERT(invariant())
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1869,10 +1858,14 @@ void UString::setFromData(const char** p, uint32_t sz)
|
||||||
|
|
||||||
if (ptr == pend)
|
if (ptr == pend)
|
||||||
{
|
{
|
||||||
(void) append(ptr, pend-ptr);
|
(void) append(ptr, pend - ptr);
|
||||||
|
|
||||||
*p = pend;
|
*p = pend;
|
||||||
|
|
||||||
|
U_INTERNAL_DUMP("size = %u, str = %V", size(), rep)
|
||||||
|
|
||||||
|
U_INTERNAL_ASSERT(invariant())
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1895,42 +1888,29 @@ void UString::setFromData(const char** p, uint32_t sz)
|
||||||
setBuffer(sz * 4);
|
setBuffer(sz * 4);
|
||||||
|
|
||||||
UEscape::decode(start, sz, *this);
|
UEscape::decode(start, sz, *this);
|
||||||
}
|
|
||||||
|
U_INTERNAL_ASSERT_MAJOR(rep->_length, 0)
|
||||||
|
|
||||||
*p = ptr;
|
*p = ptr;
|
||||||
|
|
||||||
if (empty() == false &&
|
|
||||||
shrink() == false)
|
|
||||||
{
|
|
||||||
setNullTerminated();
|
|
||||||
}
|
|
||||||
|
|
||||||
U_INTERNAL_DUMP("size = %u, str = %V", size(), rep)
|
U_INTERNAL_DUMP("size = %u, str = %V", size(), rep)
|
||||||
|
|
||||||
U_INTERNAL_ASSERT(invariant())
|
U_INTERNAL_ASSERT(invariant())
|
||||||
}
|
|
||||||
|
|
||||||
void UString::setFromData(const char** p, uint32_t sz, unsigned char delim)
|
return;
|
||||||
{
|
}
|
||||||
U_TRACE(0, "UString::setFromData(%.*S,%u,%C)", sz, *p, sz, delim)
|
|
||||||
|
|
||||||
U_ASSERT(empty())
|
loop:
|
||||||
|
if ( delim == c ||
|
||||||
const char* ptr = *p;
|
(delim != '"' &&
|
||||||
|
u__isspace(c)) ||
|
||||||
U_INTERNAL_ASSERT_EQUALS(u__isspace(*ptr), false)
|
(delim == '\0' &&
|
||||||
|
(c == '}' ||
|
||||||
for (const char* pend = ptr + sz; ptr < pend; ++ptr)
|
c == ']')))
|
||||||
{
|
|
||||||
unsigned char c = *ptr;
|
|
||||||
|
|
||||||
U_INTERNAL_DUMP("c = %C", c)
|
|
||||||
|
|
||||||
if (c == delim)
|
|
||||||
{
|
{
|
||||||
++ptr;
|
++ptr;
|
||||||
|
|
||||||
break;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c == '\\')
|
if (c == '\\')
|
||||||
|
@ -1964,16 +1944,25 @@ void UString::setFromData(const char** p, uint32_t sz, unsigned char delim)
|
||||||
}
|
}
|
||||||
|
|
||||||
_append(c);
|
_append(c);
|
||||||
|
|
||||||
|
if (++ptr <= pend)
|
||||||
|
{
|
||||||
|
c = *ptr;
|
||||||
|
|
||||||
|
U_INTERNAL_DUMP("c = %C", c)
|
||||||
|
|
||||||
|
goto loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end:
|
||||||
|
_append();
|
||||||
|
|
||||||
*p = ptr;
|
*p = ptr;
|
||||||
|
|
||||||
_append();
|
if (empty()) _assign(UStringRep::string_rep_null);
|
||||||
|
else
|
||||||
if (empty() == false &&
|
|
||||||
shrink() == false)
|
|
||||||
{
|
{
|
||||||
setNullTerminated();
|
if (shrink() == false) setNullTerminated();
|
||||||
}
|
}
|
||||||
|
|
||||||
U_INTERNAL_DUMP("size = %u, str = %V", size(), rep)
|
U_INTERNAL_DUMP("size = %u, str = %V", size(), rep)
|
||||||
|
|
|
@ -102,6 +102,7 @@ uint32_t UHTTP::range_size;
|
||||||
uint32_t UHTTP::range_start;
|
uint32_t UHTTP::range_start;
|
||||||
uint32_t UHTTP::old_path_len;
|
uint32_t UHTTP::old_path_len;
|
||||||
uint32_t UHTTP::response_code;
|
uint32_t UHTTP::response_code;
|
||||||
|
uint32_t UHTTP::sid_counter_gen;
|
||||||
uint32_t UHTTP::sid_counter_cur;
|
uint32_t UHTTP::sid_counter_cur;
|
||||||
uint32_t UHTTP::usp_page_key_len;
|
uint32_t UHTTP::usp_page_key_len;
|
||||||
uint32_t UHTTP::limit_request_body = U_STRING_MAX_SIZE;
|
uint32_t UHTTP::limit_request_body = U_STRING_MAX_SIZE;
|
||||||
|
@ -4402,8 +4403,6 @@ void UHTTP::setCookie(const UString& param)
|
||||||
{
|
{
|
||||||
U_TRACE(0, "UHTTP::setCookie(%V)", param.rep)
|
U_TRACE(0, "UHTTP::setCookie(%V)", param.rep)
|
||||||
|
|
||||||
static uint32_t sid_counter_gen;
|
|
||||||
|
|
||||||
time_t expire;
|
time_t expire;
|
||||||
uint32_t n_hours;
|
uint32_t n_hours;
|
||||||
UVector<UString> vec(param);
|
UVector<UString> vec(param);
|
||||||
|
@ -4926,9 +4925,13 @@ void UHTTP::putDataSession(uint32_t index, const char* value, uint32_t size)
|
||||||
|
|
||||||
U_INTERNAL_ASSERT_POINTER(data_session)
|
U_INTERNAL_ASSERT_POINTER(data_session)
|
||||||
|
|
||||||
|
if (size == 0) data_session->putValueVar(index, UString::getStringNull());
|
||||||
|
else
|
||||||
|
{
|
||||||
UString _value((void*)value, size);
|
UString _value((void*)value, size);
|
||||||
|
|
||||||
data_session->putValueVar(index, _value);
|
data_session->putValueVar(index, _value);
|
||||||
|
}
|
||||||
|
|
||||||
putDataSession();
|
putDataSession();
|
||||||
}
|
}
|
||||||
|
@ -4952,9 +4955,13 @@ void UHTTP::putDataStorage(uint32_t index, const char* value, uint32_t size)
|
||||||
U_INTERNAL_ASSERT_POINTER(db_session)
|
U_INTERNAL_ASSERT_POINTER(db_session)
|
||||||
U_INTERNAL_ASSERT_POINTER(data_storage)
|
U_INTERNAL_ASSERT_POINTER(data_storage)
|
||||||
|
|
||||||
|
if (size == 0) data_storage->putValueVar(index, UString::getStringNull());
|
||||||
|
else
|
||||||
|
{
|
||||||
UString _value((void*)value, size);
|
UString _value((void*)value, size);
|
||||||
|
|
||||||
data_storage->putValueVar(index, _value);
|
data_storage->putValueVar(index, _value);
|
||||||
|
}
|
||||||
|
|
||||||
putDataStorage();
|
putDataStorage();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,9 +22,9 @@ export ORM_DRIVER ORM_OPTION UMEMPOOL
|
||||||
# ----------------------------------------------------------------------------------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
# PLAINTEXT
|
# PLAINTEXT
|
||||||
# ----------------------------------------------------------------------------------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
#UMEMPOOL="982,0,0,36,9846,-24,-23,1727,1151"
|
UMEMPOOL="982,0,0,36,9846,-24,-23,1727,1151"
|
||||||
#sed -i "s|TCP_LINGER_SET .*|TCP_LINGER_SET 0|g" benchmark/FrameworkBenchmarks/fbenchmark.cfg
|
sed -i "s|TCP_LINGER_SET .*|TCP_LINGER_SET 0|g" benchmark/FrameworkBenchmarks/fbenchmark.cfg
|
||||||
#sed -i "s|LISTEN_BACKLOG .*|LISTEN_BACKLOG 16384|g" benchmark/FrameworkBenchmarks/fbenchmark.cfg
|
sed -i "s|LISTEN_BACKLOG .*|LISTEN_BACKLOG 16384|g" benchmark/FrameworkBenchmarks/fbenchmark.cfg
|
||||||
#sed -i "s|CLIENT_THRESHOLD .*|CLIENT_THRESHOLD 4000|g" benchmark/FrameworkBenchmarks/fbenchmark.cfg
|
#sed -i "s|CLIENT_THRESHOLD .*|CLIENT_THRESHOLD 4000|g" benchmark/FrameworkBenchmarks/fbenchmark.cfg
|
||||||
#sed -i "s|CLIENT_FOR_PARALLELIZATION .*|CLIENT_FOR_PARALLELIZATION 8000|g" benchmark/FrameworkBenchmarks/fbenchmark.cfg
|
#sed -i "s|CLIENT_FOR_PARALLELIZATION .*|CLIENT_FOR_PARALLELIZATION 8000|g" benchmark/FrameworkBenchmarks/fbenchmark.cfg
|
||||||
# ----------------------------------------------------------------------------------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -58,9 +58,9 @@ export ORM_DRIVER ORM_OPTION UMEMPOOL
|
||||||
# ----------------------------------------------------------------------------------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
# JSON
|
# JSON
|
||||||
# ----------------------------------------------------------------------------------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
UMEMPOOL="56,0,0,40,150,-24,-13,-20,0"
|
#UMEMPOOL="56,0,0,40,150,-24,-13,-20,0"
|
||||||
sed -i "s|TCP_LINGER_SET .*|TCP_LINGER_SET 0|g" benchmark/FrameworkBenchmarks/fbenchmark.cfg
|
#sed -i "s|TCP_LINGER_SET .*|TCP_LINGER_SET 0|g" benchmark/FrameworkBenchmarks/fbenchmark.cfg
|
||||||
sed -i "s|LISTEN_BACKLOG .*|LISTEN_BACKLOG 256|g" benchmark/FrameworkBenchmarks/fbenchmark.cfg
|
#sed -i "s|LISTEN_BACKLOG .*|LISTEN_BACKLOG 256|g" benchmark/FrameworkBenchmarks/fbenchmark.cfg
|
||||||
#sed -i "s|CLIENT_THRESHOLD .*|CLIENT_THRESHOLD 50|g" benchmark/FrameworkBenchmarks/fbenchmark.cfg
|
#sed -i "s|CLIENT_THRESHOLD .*|CLIENT_THRESHOLD 50|g" benchmark/FrameworkBenchmarks/fbenchmark.cfg
|
||||||
#sed -i "s|CLIENT_FOR_PARALLELIZATION .*|CLIENT_FOR_PARALLELIZATION 100|g" benchmark/FrameworkBenchmarks/fbenchmark.cfg
|
#sed -i "s|CLIENT_FOR_PARALLELIZATION .*|CLIENT_FOR_PARALLELIZATION 100|g" benchmark/FrameworkBenchmarks/fbenchmark.cfg
|
||||||
# ----------------------------------------------------------------------------------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -3,7 +3,7 @@ userver {
|
||||||
PORT 8080
|
PORT 8080
|
||||||
PREFORK_CHILD 4
|
PREFORK_CHILD 4
|
||||||
TCP_LINGER_SET 0
|
TCP_LINGER_SET 0
|
||||||
LISTEN_BACKLOG 256
|
LISTEN_BACKLOG 16384
|
||||||
DOCUMENT_ROOT benchmark/FrameworkBenchmarks/ULib/www
|
DOCUMENT_ROOT benchmark/FrameworkBenchmarks/ULib/www
|
||||||
PID_FILE benchmark/FrameworkBenchmarks/ULib/userver_tcp.pid
|
PID_FILE benchmark/FrameworkBenchmarks/ULib/userver_tcp.pid
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ chat|Chat|simple chat-program using ajax
|
||||||
remove|RemoveSessionCookie|you need to run this before to run the demos that use a session cookie
|
remove|RemoveSessionCookie|you need to run this before to run the demos that use a session cookie
|
||||||
json|Test 1 - JSON serialization|This test exercises the framework fundamentals including keep-alive support, request routing, request header parsing, object instantiation, JSON serialization, response header generation, and request count throughput
|
json|Test 1 - JSON serialization|This test exercises the framework fundamentals including keep-alive support, request routing, request header parsing, object instantiation, JSON serialization, response header generation, and request count throughput
|
||||||
db|Test 2 - Single database query|This test exercises the framework's object-relational mapper (ORM), random number generator, database driver, and database connection pool
|
db|Test 2 - Single database query|This test exercises the framework's object-relational mapper (ORM), random number generator, database driver, and database connection pool
|
||||||
queries|Test 3 - Multiple database queries|This test is a variation of Test #2 and also uses the World table. Multiple rows are fetched to more dramatically punish the database driver and connection pool. At the highest queries-per-request tested (20), this test demonstrates all frameworks' convergence toward zero requests-per-second as database activity increases
|
query|Test 3 - Multiple database queries|This test is a variation of Test #2 and also uses the World table. Multiple rows are fetched to more dramatically punish the database driver and connection pool. At the highest queries-per-request tested (20), this test demonstrates all frameworks' convergence toward zero requests-per-second as database activity increases
|
||||||
fortunes|Test 4 - Fortunes|This test exercises the ORM, database connectivity, dynamic-size collections, sorting, server-side templates, XSS countermeasures, and character encoding
|
fortune|Test 4 - Fortunes|This test exercises the ORM, database connectivity, dynamic-size collections, sorting, server-side templates, XSS countermeasures, and character encoding
|
||||||
updates|Test 5 - Database updates|This test is a variation of Test #3 that exercises the ORM's persistence of objects and the database driver's performance at running UPDATE statements or similar
|
update|Test 5 - Database updates|This test is a variation of Test #3 that exercises the ORM's persistence of objects and the database driver's performance at running UPDATE statements or similar
|
||||||
plaintext|Test 6 - Plaintext|This test is an exercise of the request-routing fundamentals only, designed to demonstrate the capacity of high-performance platforms in particular. The response payload is still small, meaning good performance is still necessary in order to saturate the gigabit Ethernet of the test environment
|
plaintext|Test 6 - Plaintext|This test is an exercise of the request-routing fundamentals only, designed to demonstrate the capacity of high-performance platforms in particular. The response payload is still small, meaning good performance is still necessary in order to saturate the gigabit Ethernet of the test environment
|
||||||
|
|
|
@ -9,7 +9,7 @@ start_msg client
|
||||||
|
|
||||||
rm -f server.log client.log
|
rm -f server.log client.log
|
||||||
|
|
||||||
#UTRACE="0 10M 1"
|
#UTRACE="0 10M -1"
|
||||||
#UOBJDUMP="0 1M 100"
|
#UOBJDUMP="0 1M 100"
|
||||||
#USIMERR="error.sim"
|
#USIMERR="error.sim"
|
||||||
export UTRACE UOBJDUMP USIMERR
|
export UTRACE UOBJDUMP USIMERR
|
||||||
|
|
|
@ -11,10 +11,11 @@ rm -f tmp/usp_compile.sh.err \
|
||||||
trace.*userver_*.[0-9]* object.*userver_*.[0-9]* stack.*userver_*.[0-9]* mempool.*userver_*.[0-9]* \
|
trace.*userver_*.[0-9]* object.*userver_*.[0-9]* stack.*userver_*.[0-9]* mempool.*userver_*.[0-9]* \
|
||||||
$DOC_ROOT/trace.*userver_*.[0-9]* $DOC_ROOT/object.*userver_*.[0-9]* $DOC_ROOT/stack.*userver_*.[0-9]* $DOC_ROOT/mempool.*userver_*.[0-9]*
|
$DOC_ROOT/trace.*userver_*.[0-9]* $DOC_ROOT/object.*userver_*.[0-9]* $DOC_ROOT/stack.*userver_*.[0-9]* $DOC_ROOT/mempool.*userver_*.[0-9]*
|
||||||
|
|
||||||
UTRACE="0 130M 0"
|
UTRACE="0 50M 0"
|
||||||
#UOBJDUMP="0 10M 5000"
|
UTRACE_SIGNAL="0 50M -1"
|
||||||
|
#UOBJDUMP="0 10M 100"
|
||||||
#USIMERR="error.sim"
|
#USIMERR="error.sim"
|
||||||
export UTRACE UOBJDUMP USIMERR
|
export UTRACE UOBJDUMP USIMERR UTRACE_SIGNAL
|
||||||
|
|
||||||
SOCK1=tmp/fcgi.socket
|
SOCK1=tmp/fcgi.socket
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
start_msg imap
|
start_msg imap
|
||||||
|
|
||||||
#UTRACE="0 5M 0"
|
#UTRACE="0 5M -1"
|
||||||
#UOBJDUMP="0 100k 10"
|
#UOBJDUMP="0 100k 10"
|
||||||
#USIMERR="error.sim"
|
#USIMERR="error.sim"
|
||||||
export UTRACE UOBJDUMP USIMERR
|
export UTRACE UOBJDUMP USIMERR
|
||||||
|
|
Loading…
Reference in New Issue
Block a user