Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanocasazza committed Aug 8, 2017
1 parent 493e28d commit 1b6ce8e
Show file tree
Hide file tree
Showing 81 changed files with 5,435 additions and 1,224 deletions.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ EXTRA_DIST = $(configfiles:%=%.in) \
cdb configure.help TODO LICENSE* README* *.spec* \
ULib.m4 rpm.sh rpmpkgreq.lst rpmpkgreq.lst.suse openwrt \
doc/Doxyfile doc/readme.txt shtool *.awk .travis.yml autogen.sh nativejson-benchmark \
fuzz/http1-corpus fuzz/http2-corpus fuzz/build_libFuzzer.sh fuzz/Makefile.in fuzz/Makefile.am fuzz/uclient_fuzzer.cpp fuzz/uclient.cfg
fuzz/http1-corpus fuzz/http2-corpus fuzz/build_libFuzzer.sh fuzz/Makefile.in fuzz/Makefile.am fuzz/*.cpp fuzz/uclient.cfg

MAINTAINERCLEANFILES = configure aclocal.m4 libtool Makefile.in Makefile INSTALL

Expand Down
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ EXTRA_DIST = $(configfiles:%=%.in) \
cdb configure.help TODO LICENSE* README* *.spec* \
ULib.m4 rpm.sh rpmpkgreq.lst rpmpkgreq.lst.suse openwrt \
doc/Doxyfile doc/readme.txt shtool *.awk .travis.yml autogen.sh nativejson-benchmark \
fuzz/http1-corpus fuzz/http2-corpus fuzz/build_libFuzzer.sh fuzz/Makefile.in fuzz/Makefile.am fuzz/uclient_fuzzer.cpp fuzz/uclient.cfg
fuzz/http1-corpus fuzz/http2-corpus fuzz/build_libFuzzer.sh fuzz/Makefile.in fuzz/Makefile.am fuzz/*.cpp fuzz/uclient.cfg

MAINTAINERCLEANFILES = configure aclocal.m4 libtool Makefile.in Makefile INSTALL
moduledir = @ULIB_MODULEDIR@
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,9 @@ Comments and suggestions are welcome.
stefano casazza <[email protected]>

Please, excuse me for my bad english, it's not my natural language, if some parts of this page seems wrong to you, feel free to suggest me better ones.

## Donation

If this project help you reduce time to develop, you can give me a cup of coffee :)

[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/stefanocasazza)
79 changes: 50 additions & 29 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -26244,7 +26244,9 @@ if test "${enable_CRPWS+set}" = set; then :
fi

if test -z "$enable_CRPWS"; then
if test "$enable_debug" = "yes"; then
if test "$USP_FLAGS" = "-DAS_cpoll_cppsp_DO"; then
enable_CRPWS="no"
elif test "$enable_debug" = "yes"; then
enable_CRPWS="yes"
else
enable_CRPWS="no"
Expand All @@ -26266,7 +26268,11 @@ if test "${enable_captive_portal+set}" = set; then :
fi

if test -z "$enable_captive_portal"; then
enable_captive_portal="no"
if test "$USP_FLAGS" = "-DAS_cpoll_cppsp_DO"; then
enable_captive_portal="yes"
else
enable_captive_portal="no"
fi
fi
if test "$enable_captive_portal" = "yes"; then

Expand Down Expand Up @@ -26302,7 +26308,9 @@ if test "${enable_HIS+set}" = set; then :
fi

if test -z "$enable_HIS" ; then
if test "$enable_debug" = "yes"; then
if test "$USP_FLAGS" = "-DAS_cpoll_cppsp_DO"; then
enable_HIS="no"
elif test "$enable_debug" = "yes"; then
enable_HIS="yes"
else
enable_HIS="no"
Expand Down Expand Up @@ -26346,7 +26354,9 @@ if test "${enable_GSDS+set}" = set; then :
fi

if test -z "$enable_GSDS"; then
if test "$enable_debug" = "yes"; then
if test "$USP_FLAGS" = "-DAS_cpoll_cppsp_DO"; then
enable_GSDS="no"
elif test "$enable_debug" = "yes"; then
enable_GSDS="yes"
else
enable_GSDS="no"
Expand Down Expand Up @@ -26430,7 +26440,9 @@ if test "${enable_check_time+set}" = set; then :
fi

if test -z "$enable_check_time"; then
if test "$enable_debug" = "yes" -a "$enable_http2" != "yes"; then
if test "$USP_FLAGS" = "-DAS_cpoll_cppsp_DO"; then
enable_check_time="no"
elif test "$enable_debug" = "yes" -a "$enable_http2" != "yes"; then
enable_check_time="yes"
else
enable_check_time="no"
Expand Down Expand Up @@ -26582,7 +26594,9 @@ if test "${enable_HSTS+set}" = set; then :
fi

if test -z "$enable_HSTS"; then
if test "$enable_debug" = "yes"; then
if test "$USP_FLAGS" = "-DAS_cpoll_cppsp_DO"; then
enable_HSTS="no"
elif test "$enable_debug" = "yes"; then
enable_HSTS="yes"
else
enable_HSTS="no"
Expand Down Expand Up @@ -28342,7 +28356,7 @@ fi
MYSQL_INCLUDE=`mysql_config --include`
libmysql_version=$(grep LIBMYSQL_VERSION /usr/include/mysql/mysql_version.h 2>/dev/null | head -n1 | cut -d'"' -f2)
else
MYSQL_INCLUDE=-I$ac_mysql_incdir
MYSQL_INCLUDE=$ac_mysql_incdir
libmysql_version=$(grep LIBMYSQL_VERSION $ac_mysql_incdir/mysql/mysql_version.h 2>/dev/null | head -n1 | cut -d'"' -f2)
fi
if test "$ac_mysql_libdir" = "no"; then
Expand Down Expand Up @@ -28471,11 +28485,18 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PostgreSQL libraries" >&5
$as_echo_n "checking for PostgreSQL libraries... " >&6; }

POSTGRESQL_CPPFLAGS="`$PG_CONFIG --includedir` -I`$PG_CONFIG --includedir-server`"
POSTGRESQL_LDFLAGS=-L"`$PG_CONFIG --libdir`"
POSTGRESQL_LIBS="-lpq"
postgresql_libdir=`$PG_CONFIG --libdir`

POSTGRESQL_LDFLAGS=-L"$postgresql_libdir"
POSTGRESQL_CPPFLAGS="-I`$PG_CONFIG --includedir` -I`$PG_CONFIG --includedir-server`"
POSTGRESQL_VERSION=`$PG_CONFIG --version | sed -e 's#PostgreSQL ##'`

if test -f "$postgresql_libdir/libpgport.a"; then
POSTGRESQL_LIBS="-lpq -lpgport"
else
POSTGRESQL_LIBS="-lpq"
fi


$as_echo "#define HAVE_POSTGRESQL 1" >>confdefs.h

Expand Down Expand Up @@ -31537,7 +31558,7 @@ if test "${enable_static_server_plugin+set}" = set; then :
fi


for mod in $modules; do
for mod in $use_static_module; do
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking server plugin \"$mod\"" >&5
$as_echo_n "checking server plugin \"$mod\"... " >&6; }

Expand Down Expand Up @@ -31781,7 +31802,7 @@ if test "${enable_static_orm_driver+set}" = set; then :
fi


for drv in $drivers; do
for drv in $use_static_driver; do
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking ORM driver \"$drv\"" >&5
$as_echo_n "checking ORM driver \"$drv\"... " >&6; }

Expand All @@ -31793,26 +31814,26 @@ $as_echo_n "checking ORM driver \"$drv\"... " >&6; }
static_handler_sqlite="yes"
ULIB_LIBS="$ULIB_LIBS $SQLITE3_LIBS"
LDFLAGS="$SQLITE3_LDFLAGS $LDFLAGS"
CPPFLAGS="$SQLITE3_INCLUDE $CPPFLAGS"
CXXFLAGS="$SQLITE3_INCLUDE $CXXFLAGS"

$as_echo "#define U_STATIC_ORM_DRIVER_SQLITE /**/" >>confdefs.h

elif test "$drv" = "mysql"; then
static_handler_mysql="yes"
ULIB_LIBS="$ULIB_LIBS $MYSQL_LIBS"
LDFLAGS="$MYSQL_LDFLAGS $LDFLAGS"
CPPFLAGS="$MYSQL_INCLUDE $CPPFLAGS"

$as_echo "#define U_STATIC_ORM_DRIVER_MYSQL /**/" >>confdefs.h

elif test "$drv" = "pgsql"; then
static_handler_pgsql="yes"
ULIB_LIBS="$ULIB_LIBS $POSTGRESQL_LIBS"
LDFLAGS="$POSTGRESQL_LDFLAGS $LDFLAGS"
CPPFLAGS="$POSTGRESQL_CPPFLAGS $CPPFLAGS"
CXXFLAGS="$POSTGRESQL_CPPFLAGS $CXXFLAGS"

$as_echo "#define U_STATIC_ORM_DRIVER_PGSQL /**/" >>confdefs.h

elif test "$drv" = "mysql"; then
static_handler_mysql="yes"
ULIB_LIBS="$ULIB_LIBS $MYSQL_LIBS"
LDFLAGS="$MYSQL_LDFLAGS $LDFLAGS"
CXXFLAGS="$MYSQL_INCLUDE $CXXFLAGS"

$as_echo "#define U_STATIC_ORM_DRIVER_MYSQL /**/" >>confdefs.h

fi

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: static" >&5
Expand Down Expand Up @@ -32087,6 +32108,13 @@ CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-rtti"

if test "$ac_cv_c_compiler_gnu" = "yes" -a "x$GCC_IS_CLANG" = xno -a "x$OPERATINGSYSTEM" = xlinux; then


{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5
$as_echo "" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${T_MD}Checking for gcc compiler flags:${T_ME}" >&5
$as_echo "${T_MD}Checking for gcc compiler flags:${T_ME}" >&6; }


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use libgcc" >&5
$as_echo_n "checking whether to use libgcc... " >&6; }
# Check whether --enable-libgcc was given.
Expand All @@ -32108,13 +32136,6 @@ $as_echo "no" >&6; }
fi



{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5
$as_echo "" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${T_MD}Checking for gcc compiler flags:${T_ME}" >&5
$as_echo "${T_MD}Checking for gcc compiler flags:${T_ME}" >&6; }


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports " >&5
$as_echo_n "checking whether $CC supports ... " >&6; }

Expand Down
27 changes: 14 additions & 13 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2001,7 +2001,7 @@ AC_ARG_ENABLE(static-server-plugin,
AS_HELP_STRING([--enable-static-server-plugin=MODULES],[ rpc shib stream socket scgi fcgi geoip proxy soap ssi tsa nocat http echo ]),
[use_static_module="$enableval"])

for mod in $modules; do
for mod in $use_static_module; do
AC_MSG_CHECKING([server plugin "$mod"])

if echo $use_static_module | grep -w $mod >/dev/null || echo $use_static_module | grep all >/dev/null; then
Expand Down Expand Up @@ -2103,10 +2103,11 @@ static_handler_mysql=""
static_handler_sqlite=""
static_handler_pgsql=""

AC_ARG_ENABLE(static-orm-driver, AS_HELP_STRING([--enable-static-orm-driver=DRIVERS],[ sqlite mysql pgsql ]),
AC_ARG_ENABLE(static-orm-driver,
AS_HELP_STRING([--enable-static-orm-driver=DRIVERS],[ sqlite mysql pgsql ]),
[use_static_driver="$enableval"])

for drv in $drivers; do
for drv in $use_static_driver; do
AC_MSG_CHECKING([ORM driver "$drv"])

if echo $use_static_driver | grep -w $drv >/dev/null || echo $use_static_driver | grep all >/dev/null; then
Expand All @@ -2117,20 +2118,20 @@ for drv in $drivers; do
static_handler_sqlite="yes"
ULIB_LIBS="$ULIB_LIBS $SQLITE3_LIBS"
LDFLAGS="$SQLITE3_LDFLAGS $LDFLAGS"
CPPFLAGS="$SQLITE3_INCLUDE $CPPFLAGS"
CXXFLAGS="$SQLITE3_INCLUDE $CXXFLAGS"
AC_DEFINE(U_STATIC_ORM_DRIVER_SQLITE,, [STATIC_ORM_DRIVER_SQLITE])
elif test "$drv" = "mysql"; then
static_handler_mysql="yes"
ULIB_LIBS="$ULIB_LIBS $MYSQL_LIBS"
LDFLAGS="$MYSQL_LDFLAGS $LDFLAGS"
CPPFLAGS="$MYSQL_INCLUDE $CPPFLAGS"
AC_DEFINE(U_STATIC_ORM_DRIVER_MYSQL,, [STATIC_ORM_DRIVER_MYSQL])
elif test "$drv" = "pgsql"; then
static_handler_pgsql="yes"
ULIB_LIBS="$ULIB_LIBS $POSTGRESQL_LIBS"
LDFLAGS="$POSTGRESQL_LDFLAGS $LDFLAGS"
CPPFLAGS="$POSTGRESQL_CPPFLAGS $CPPFLAGS"
CXXFLAGS="$POSTGRESQL_CPPFLAGS $CXXFLAGS"
AC_DEFINE(U_STATIC_ORM_DRIVER_PGSQL,, [STATIC_ORM_DRIVER_PGSQL])
elif test "$drv" = "mysql"; then
static_handler_mysql="yes"
ULIB_LIBS="$ULIB_LIBS $MYSQL_LIBS"
LDFLAGS="$MYSQL_LDFLAGS $LDFLAGS"
CXXFLAGS="$MYSQL_INCLUDE $CXXFLAGS"
AC_DEFINE(U_STATIC_ORM_DRIVER_MYSQL,, [STATIC_ORM_DRIVER_MYSQL])
fi

AC_MSG_RESULT([static])
Expand Down Expand Up @@ -2253,6 +2254,8 @@ CXXFLAGS="$CXXFLAGS -fno-exceptions -fno-rtti"

if test "$ac_cv_c_compiler_gnu" = "yes" -a "x$GCC_IS_CLANG" = xno -a "x$OPERATINGSYSTEM" = xlinux; then

TWOCAN_CONF_MSG(Checking for gcc compiler flags)

AC_MSG_CHECKING([whether to use libgcc])
AC_ARG_ENABLE(libgcc,
AC_HELP_STRING([--enable-libgcc],[use libgcc when linking]),
Expand All @@ -2267,8 +2270,6 @@ if test "$ac_cv_c_compiler_gnu" = "yes" -a "x$GCC_IS_CLANG" = xno -a "x$OPERATIN
AC_MSG_RESULT(no)
)

TWOCAN_CONF_MSG(Checking for gcc compiler flags)

AC_CC_TRY_FLAG

MAYBE_FLAGS="-Wstrict-aliasing=2 -Wall -Wextra -Wsign-compare -Wpointer-arith -Wwrite-strings \
Expand Down
29 changes: 25 additions & 4 deletions examples/WiAuth/cdbmake.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// cdbmake.cpp

#include <ulib/db/cdb.h>
#include <ulib/net/server/server.h>
#include <ulib/utility/string_ext.h>

#undef PACKAGE
Expand All @@ -27,9 +28,20 @@ class Application : public UApplication {

UApplication::run(argc, argv, env);

UString records = UFile::contentOf(UString(argv[optind]));
uint32_t len;
const char* path_of_record_file = argv[optind];

if (path_of_record_file == U_NULLPTR ||
(len = u__strlen(path_of_record_file, __PRETTY_FUNCTION__)) == 0)
{
U_ERROR("missing <path_of_record_file> argument");
}

UString filename = UString(path_of_record_file, len);

# ifdef U_STDCPP_ENABLE
UString records = UFile::contentOf(filename);

if (records)
{
UCDB x(false);
Expand All @@ -38,9 +50,7 @@ class Application : public UApplication {
x.UFile::ftruncate(UCDB::sizeFor(1) + records.size() * 2) &&
x.UFile::memmap(PROT_READ | PROT_WRITE))
{
const char* bcheck = argv[++optind];

if (bcheck)
if (argv[++optind])
{
// +11,10:[email protected]>0 10.8.1.5
// ....
Expand Down Expand Up @@ -86,6 +96,17 @@ class Application : public UApplication {
records = output;
}

UString basename = UStringExt::basename(filename);

const char* p = basename.data();

# ifdef U_EVASIVE_SUPPORT
if (memcmp(p, U_CONSTANT_TO_PARAM("Evasive")) == 0) UCDB::getValueFromBuffer = UServer_Base::getEvasiveRecFromBuffer;
# endif
# ifdef U_THROTTLING_SUPPORT
if (memcmp(p, U_CONSTANT_TO_PARAM("BandWidthThrottling")) == 0) UCDB::getValueFromBuffer = UServer_Base::getThrottlingRecFromBuffer;
# endif

istrstream is(U_STRING_TO_PARAM(records));

is >> x; // NB: this do ftruncate() e munmap()...
Expand Down
Loading

0 comments on commit 1b6ce8e

Please sign in to comment.