Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanocasazza committed Apr 1, 2017
1 parent 568419a commit 48d7ee4
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 21 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -72,7 +72,7 @@ The current version offers the following features :

## Who is Using ULib

It is the main software component of [city of Florence wireless network](http://wifi-aaa2.comune.fi.it/login?mac=00%3A00%3A00%3A00%3A00%3A00&ip=172.22.11.124&redirect=http%3A//pasta.dianxinos.com/api/data&gateway=159.213.248.230%3A5280&timeout=0&token=1810300063&ap=05@159.213.248.230&ts=21467819142)
It is the main software component of [city of Florence wireless network](http://wifi-aaa2.comune.fi.it/login?mac=00%3A00%3A00%3A00%3A00%3A00&ip=172.22.11.124&redirect=http%3A//pasta.dianxinos.com/api/data&gateway=159.213.248.230%3A5280&timeout=0&token=1810300063&ap=90@151.11.47.5&ts=2467819142)

## Benchmark

Expand Down
13 changes: 6 additions & 7 deletions include/ulib/examples/wi_auth_declaration.h
Expand Up @@ -1169,15 +1169,14 @@ loop: pos = db_anagrafica->find(*ap_address, pos);
{
if (findLabel() == false)
{
if (binsert == false ||
ap_address_trust == false)
{
U_RETURN(false);
}
if (ap_address_trust == false) U_RETURN(false);

op = RDB_REPLACE;
if (binsert)
{
op = RDB_REPLACE;

addAccessPoint(getNoConsumeFromAnagrafica());
addAccessPoint(getNoConsumeFromAnagrafica());
}
}

if ( ap_hostname->empty()) *ap_hostname = hostname;
Expand Down
43 changes: 38 additions & 5 deletions include/ulib/json/value.h
Expand Up @@ -518,6 +518,22 @@ class U_EXPORT UValue {
U_RETURN(false);
}

static bool jfind(const UString& json, const char* query, uint32_t query_len, unsigned int& result)
{
U_TRACE(0, "UValue::jfind(%V,%.*S,%u,%p)", json.rep, query_len, query, query_len, &result)

UString x;

if (jfind(json, query, query_len, x))
{
result = u_strtoul(x.data(), x.pend());

U_RETURN(true);
}

U_RETURN(false);
}

static bool jfind(const UString& json, const char* query, uint32_t query_len, int64_t& result)
{
U_TRACE(0, "UValue::jfind(%V,%.*S,%u,%p)", json.rep, query_len, query, query_len, &result)
Expand All @@ -534,7 +550,21 @@ class U_EXPORT UValue {
U_RETURN(false);
}

static bool jfind(const UString& json, const UString& query, int64_t& result) { return jfind(json, U_STRING_TO_PARAM(query), result); }
static bool jfind(const UString& json, const char* query, uint32_t query_len, uint64_t& result)
{
U_TRACE(0, "UValue::jfind(%V,%.*S,%u,%p)", json.rep, query_len, query, query_len, &result)

UString x;

if (jfind(json, query, query_len, x))
{
result = u_strtoull(x.data(), x.pend());

U_RETURN(true);
}

U_RETURN(false);
}

static bool jfind(const UString& json, const char* query, uint32_t query_len, double& result)
{
Expand All @@ -552,10 +582,13 @@ class U_EXPORT UValue {
U_RETURN(false);
}

static bool jfind(const UString& json, const UString& query, UString& result) { return jfind(json, U_STRING_TO_PARAM(query), result); }
static bool jfind(const UString& json, const UString& query, bool& result) { return jfind(json, U_STRING_TO_PARAM(query), result); }
static bool jfind(const UString& json, const UString& query, int& result) { return jfind(json, U_STRING_TO_PARAM(query), result); }
static bool jfind(const UString& json, const UString& query, double& result) { return jfind(json, U_STRING_TO_PARAM(query), result); }
static bool jfind(const UString& json, const UString& query, UString& result) { return jfind(json, U_STRING_TO_PARAM(query), result); }
static bool jfind(const UString& json, const UString& query, bool& result) { return jfind(json, U_STRING_TO_PARAM(query), result); }
static bool jfind(const UString& json, const UString& query, int& result) { return jfind(json, U_STRING_TO_PARAM(query), result); }
static bool jfind(const UString& json, const UString& query, unsigned int& result) { return jfind(json, U_STRING_TO_PARAM(query), result); }
static bool jfind(const UString& json, const UString& query, int64_t& result) { return jfind(json, U_STRING_TO_PARAM(query), result); }
static bool jfind(const UString& json, const UString& query, uint64_t& result) { return jfind(json, U_STRING_TO_PARAM(query), result); }
static bool jfind(const UString& json, const UString& query, double& result) { return jfind(json, U_STRING_TO_PARAM(query), result); }

// reads one value from an array

Expand Down
17 changes: 9 additions & 8 deletions src/ulib/net/server/server.cpp
Expand Up @@ -1322,19 +1322,20 @@ void UServer_Base::manageChangeOfSystemTime()
if (u_setStartTime() == false)
{
U_WARNING("System date update failed: %#5D", u_now->tv_sec);

return;
}

#if defined(U_LINUX) && defined(ENABLE_THREAD)
else
if (u_now_adjust_old != u_now_adjust &&
update_date)
{
if (u_now_adjust_old != u_now_adjust)
{
if (u_pthread_time) (void) U_SYSCALL(pthread_rwlock_wrlock, "%p", ULog::prwlock);
if (u_pthread_time) (void) U_SYSCALL(pthread_rwlock_wrlock, "%p", ULog::prwlock);

(void) u_strftime2(ULog::ptr_shared_date->date1, 17, U_CONSTANT_TO_PARAM("%d/%m/%y %T"), u_now->tv_sec + u_now_adjust);
(void) u_strftime2(ULog::ptr_shared_date->date2, 26, U_CONSTANT_TO_PARAM("%d/%b/%Y:%T %z"), u_now->tv_sec + u_now_adjust);
(void) u_strftime2(ULog::ptr_shared_date->date1, 17, U_CONSTANT_TO_PARAM("%d/%m/%y %T"), u_now->tv_sec + u_now_adjust);
(void) u_strftime2(ULog::ptr_shared_date->date2, 26, U_CONSTANT_TO_PARAM("%d/%b/%Y:%T %z"), u_now->tv_sec + u_now_adjust);

if (u_pthread_time) (void) U_SYSCALL(pthread_rwlock_unlock, "%p", ULog::prwlock);
}
if (u_pthread_time) (void) U_SYSCALL(pthread_rwlock_unlock, "%p", ULog::prwlock);
}
#endif
}
Expand Down
2 changes: 2 additions & 0 deletions src/ulib/utility/uhttp.cpp
Expand Up @@ -9151,6 +9151,8 @@ bool UHTTP::getCGIEnvironment(UString& environment, int type)
sz = UClientImage_Base::request_uri->size();
ptr = UClientImage_Base::request_uri->data();

(void) buffer.reserve(2000U + sz * 2);

if (U_http_info.query_len &&
(type & U_SHELL) == 0)
{
Expand Down
2 changes: 2 additions & 0 deletions tests/examples/web_server_ssl.sh
Expand Up @@ -59,6 +59,8 @@ DIR_CMD="../../examples/userver"
#STRACE=$TRUSS
start_prg_background userver_ssl -c inp/webserver.cfg

wait_server_ready localhost 443

#$SLEEP
#kill_prg userver_ssl TERM

Expand Down

0 comments on commit 48d7ee4

Please sign in to comment.