added --enable-quadmath in configure.ac
This commit is contained in:
parent
a34831a2e9
commit
d18fbfc412
@ -4,7 +4,7 @@ ACLOCAL_AMFLAGS = -I m4
|
||||
EXTRA_DIST =
|
||||
|
||||
SUBDIRS = lib bin t
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
|
||||
distclean-local:
|
||||
rm -rf $(top_srcdir)/autom4te.cache
|
||||
|
@ -162,7 +162,7 @@ am__DIST_COMMON = $(srcdir)/Dockerfile.in $(srcdir)/Makefile.in \
|
||||
$(top_srcdir)/ac/config.guess $(top_srcdir)/ac/config.sub \
|
||||
$(top_srcdir)/ac/install-sh $(top_srcdir)/ac/ltmain.sh \
|
||||
$(top_srcdir)/ac/missing $(top_srcdir)/ac/tap-driver.sh \
|
||||
$(top_srcdir)/pkgs/hio.spec.in ac/ar-lib ac/compile \
|
||||
$(top_srcdir)/pkgs/hio.spec.in README.md ac/ar-lib ac/compile \
|
||||
ac/config.guess ac/config.sub ac/depcomp ac/install-sh \
|
||||
ac/ltmain.sh ac/missing
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
@ -357,7 +357,7 @@ AUTOMAKE_OPTION = foreign
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
EXTRA_DIST =
|
||||
SUBDIRS = lib bin t
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
all: all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
|
25
configure
vendored
25
configure
vendored
@ -624,7 +624,7 @@ PACKAGE_TARNAME='hio'
|
||||
PACKAGE_VERSION='0.1.0'
|
||||
PACKAGE_STRING='hio 0.1.0'
|
||||
PACKAGE_BUGREPORT='Chung, Hyung-Hwan (hyunghwan.chung@gmail.com)'
|
||||
PACKAGE_URL='http://code.miflux.com/@hio'
|
||||
PACKAGE_URL='http://code.miflux.com/hyung-hwan/hio'
|
||||
|
||||
# Factoring default headers for most tests.
|
||||
ac_includes_default="\
|
||||
@ -834,6 +834,7 @@ enable_libtool_lock
|
||||
enable_largefile
|
||||
enable_all_static
|
||||
with_all_static_libs
|
||||
enable_quadmath
|
||||
enable_ssl
|
||||
enable_mariadb
|
||||
with_mariadb
|
||||
@ -1492,6 +1493,8 @@ Optional Features:
|
||||
--disable-libtool-lock avoid locking (might break parallel builds)
|
||||
--disable-largefile omit support for large files
|
||||
--enable-all-static build the full static binaries(default. no)
|
||||
--enable-quadmath attempt to support 128-bit floating point number if
|
||||
available(default. no)
|
||||
--enable-ssl build the library in the ssl mode (default. yes)
|
||||
--enable-mariadb enable mariadb support (default. no)
|
||||
--enable-debug build the library in the debug mode (default. no)
|
||||
@ -1534,7 +1537,7 @@ Use these variables to override the choices made by `configure' or to help
|
||||
it to find libraries and programs with nonstandard names/locations.
|
||||
|
||||
Report bugs to <Chung, Hyung-Hwan (hyunghwan.chung@gmail.com)>.
|
||||
hio home page: <http://code.miflux.com/@hio>.
|
||||
hio home page: <http://code.miflux.com/hyung-hwan/hio>.
|
||||
_ACEOF
|
||||
ac_status=$?
|
||||
fi
|
||||
@ -17084,6 +17087,16 @@ fi
|
||||
ALL_STATIC_LIBS="$with_all_static_libs"
|
||||
|
||||
|
||||
# Check whether --enable-quadmath was given.
|
||||
if test ${enable_quadmath+y}
|
||||
then :
|
||||
enableval=$enable_quadmath; enable_quadmath_is=$enableval
|
||||
else $as_nop
|
||||
enable_quadmath_is=no
|
||||
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --enable-ssl was given.
|
||||
if test ${enable_ssl+y}
|
||||
then :
|
||||
@ -20163,6 +20176,11 @@ fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
fi
|
||||
|
||||
if test "x${enable_quadmath_is}" == "xno"
|
||||
then
|
||||
ac_cv_sizeof___float128=0
|
||||
fi
|
||||
|
||||
if test ${ac_cv_sizeof___float128} -gt 0
|
||||
then
|
||||
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking __float128 with linking" >&5
|
||||
@ -20192,7 +20210,6 @@ else $as_nop
|
||||
printf "%s\n" "no" >&6; }
|
||||
ac_cv_sizeof___float128=0
|
||||
|
||||
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
@ -21415,7 +21432,7 @@ Configuration commands:
|
||||
$config_commands
|
||||
|
||||
Report bugs to <Chung, Hyung-Hwan (hyunghwan.chung@gmail.com)>.
|
||||
hio home page: <http://code.miflux.com/@hio>."
|
||||
hio home page: <http://code.miflux.com/hyung-hwan/hio>."
|
||||
|
||||
_ACEOF
|
||||
ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"`
|
||||
|
86
configure.ac
86
configure.ac
@ -1,6 +1,6 @@
|
||||
dnl AC_PREREQ([2.71])
|
||||
|
||||
AC_INIT([hio],[0.1.0],[Chung, Hyung-Hwan (hyunghwan.chung@gmail.com)],[],[http://code.miflux.com/@hio])
|
||||
AC_INIT([hio],[0.1.0],[Chung, Hyung-Hwan (hyunghwan.chung@gmail.com)],[],[http://code.miflux.com/hyung-hwan/hio])
|
||||
|
||||
AC_CONFIG_HEADERS([lib/hio-cfg.h])
|
||||
AC_CONFIG_AUX_DIR([ac])
|
||||
@ -124,7 +124,7 @@ AC_CHECK_HEADERS([sys/stropts.h sys/macstat.h linux/ethtool.h linux/sockios.h])
|
||||
AC_CHECK_HEADERS([quadmath.h crt_externs.h sys/prctl.h paths.h pty.h])
|
||||
|
||||
dnl check data types
|
||||
dnl AC_CHECK_TYPE([wchar_t],
|
||||
dnl AC_CHECK_TYPE([wchar_t],
|
||||
dnl [ AC_DEFINE([HAVE_WCHAR_T_IN_STDDEF_H],
|
||||
dnl [],[wchar_t is available in stddef.h]) ],
|
||||
dnl [],
|
||||
@ -171,7 +171,7 @@ then
|
||||
AC_CHECK_LIB([socket], [connect], [
|
||||
SOCKET_LIBS="$SOCKET_LIBS -lsocket"
|
||||
AC_DEFINE(HAVE_CONNECT, 1)
|
||||
])
|
||||
])
|
||||
|
||||
if test "x$ac_cv_lib_socket_connect" = xno
|
||||
then
|
||||
@ -250,14 +250,14 @@ AC_CHECK_LIB([pthread], [pthread_mutex_trylock], [
|
||||
])
|
||||
|
||||
dnl ===== enable-all-static =====
|
||||
AC_ARG_ENABLE([all-static],
|
||||
AC_ARG_ENABLE([all-static],
|
||||
[AS_HELP_STRING([--enable-all-static],[build the full static binaries(default. no)])],
|
||||
enable_all_static_is=$enableval,
|
||||
enable_all_static_is=no
|
||||
)
|
||||
AM_CONDITIONAL(ENABLE_ALL_STATIC, test "x${enable_all_static_is}" = "xyes")
|
||||
|
||||
AC_ARG_WITH([all-static-libs],
|
||||
AC_ARG_WITH([all-static-libs],
|
||||
[AS_HELP_STRING([--with-all-static-libs[[=lib-list]]],[specify extra libraries to add for building the full static binaries])],
|
||||
[],
|
||||
[with_all_static_libs=]
|
||||
@ -265,8 +265,15 @@ AC_ARG_WITH([all-static-libs],
|
||||
ALL_STATIC_LIBS="$with_all_static_libs"
|
||||
AC_SUBST(ALL_STATIC_LIBS)
|
||||
|
||||
dnl ===== enable-quadmath =====
|
||||
AC_ARG_ENABLE([quadmath],
|
||||
[AS_HELP_STRING([--enable-quadmath],[attempt to support 128-bit floating point number if available(default. no)])],
|
||||
enable_quadmath_is=$enableval,
|
||||
enable_quadmath_is=no
|
||||
)
|
||||
|
||||
dnl ===== enable-ssl =====
|
||||
AC_ARG_ENABLE([ssl],
|
||||
AC_ARG_ENABLE([ssl],
|
||||
[AS_HELP_STRING([--enable-ssl],[build the library in the ssl mode (default. yes)])],
|
||||
enable_ssl_is=$enableval,
|
||||
enable_ssl_is=yes
|
||||
@ -277,13 +284,13 @@ then
|
||||
|
||||
dnl check for an SSL library
|
||||
dnl i used SSL_library_init at first.
|
||||
dnl starting from openssl 1.1.0, SSL_library_init was made to a macro
|
||||
dnl starting from openssl 1.1.0, SSL_library_init was made to a macro
|
||||
dnl aliasing OPENSSL_init_ssl.
|
||||
dnl #define SSL_library_init() OPENSSL_init_ssl(0, NULL)
|
||||
dnl instead of checking both, now i use SSL_new.
|
||||
AC_CHECK_FUNCS([SSL_new])
|
||||
|
||||
if test "x$ac_cv_func_SSL_new" = "xyes"
|
||||
if test "x$ac_cv_func_SSL_new" = "xyes"
|
||||
then
|
||||
AC_DEFINE(HAVE_SSL, 1, [ssl support])
|
||||
else
|
||||
@ -364,8 +371,8 @@ AC_CHECK_TYPES([struct lifconf, struct lifreq, struct if_laddrreq], [], [],
|
||||
#endif])
|
||||
|
||||
AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id], [], [],
|
||||
[#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
[#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>])
|
||||
|
||||
AC_CHECK_TYPES([struct timespec], [], [],
|
||||
@ -378,8 +385,8 @@ AC_CHECK_TYPES([struct timespec], [], [],
|
||||
#endif])
|
||||
|
||||
AC_CHECK_TYPES([struct ip_mreqn], [], [],
|
||||
[#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
[#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>])
|
||||
|
||||
AC_MSG_CHECKING([for va_copy])
|
||||
@ -395,7 +402,7 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>]], [[
|
||||
AC_MSG_CHECKING([for __va_copy])
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>]], [[
|
||||
va_list x, y;
|
||||
__va_copy(x,y);
|
||||
__va_copy(x,y);
|
||||
]])],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([HAVE___VA_COPY], [1], [__va_copy is available])
|
||||
@ -423,7 +430,7 @@ AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <string.h>
|
||||
dnl cross-compiling, assume yes
|
||||
AC_MSG_RESULT(unknown)
|
||||
AC_DEFINE([HAVE_STRFTIME_SMALL_Z], [1], [strftime supports %z])
|
||||
|
||||
|
||||
])
|
||||
|
||||
dnl check the size of primitive data types
|
||||
@ -491,9 +498,9 @@ then
|
||||
{
|
||||
unsigned short chan;
|
||||
}
|
||||
struct sockaddr_in_x {
|
||||
struct sockaddr_in a;
|
||||
struct sockaddr_extra_t u;
|
||||
struct sockaddr_in_x {
|
||||
struct sockaddr_in a;
|
||||
struct sockaddr_extra_t u;
|
||||
};
|
||||
])
|
||||
AC_CHECK_SIZEOF(struct sockaddr_in6_x,,[
|
||||
@ -503,9 +510,9 @@ then
|
||||
{
|
||||
unsigned short chan;
|
||||
};
|
||||
struct sockaddr_in6_x {
|
||||
struct sockaddr_in6_x {
|
||||
struct sockaddr_in6 a;
|
||||
struct sockaddr_extra_t u;
|
||||
struct sockaddr_extra_t u;
|
||||
};
|
||||
])
|
||||
|
||||
@ -569,9 +576,9 @@ else
|
||||
{
|
||||
unsigned short chan;
|
||||
};
|
||||
struct sockaddr_in_x {
|
||||
struct sockaddr_in a;
|
||||
struct sockaddr_extra_t u;
|
||||
struct sockaddr_in_x {
|
||||
struct sockaddr_in a;
|
||||
struct sockaddr_extra_t u;
|
||||
};
|
||||
])
|
||||
AC_CHECK_SIZEOF(struct sockaddr_in6_x,,[
|
||||
@ -582,9 +589,9 @@ else
|
||||
{
|
||||
unsigned short chan;
|
||||
};
|
||||
struct sockaddr_in6_x {
|
||||
struct sockaddr_in6_x {
|
||||
struct sockaddr_in6 a;
|
||||
struct sockaddr_extra_t u;
|
||||
struct sockaddr_extra_t u;
|
||||
};
|
||||
])
|
||||
|
||||
@ -637,14 +644,14 @@ else
|
||||
AC_DEFINE_UNQUOTED(HIO_OFFSETOF_SA_FAMILY, ${ac_cv_offsetof_sa_family}, [offsetof(struct sockaddr, sa_family)])
|
||||
fi
|
||||
|
||||
dnl gcc 3.4.3 on opensolaris x86 gave this warning without -msse or
|
||||
dnl gcc 3.4.3 on opensolaris x86 gave this warning without -msse or
|
||||
dnl something similar.
|
||||
dnl SSE vector argument without SSE enabled changes the ABI
|
||||
dnl it also ended with an internal compiler error while compiling
|
||||
dnl it also ended with an internal compiler error while compiling
|
||||
dnl some expressions like 'v % base' where v is of the __int128_t type.
|
||||
dnl so i've added this check to determine if the compiler has
|
||||
dnl proper support for __int128_t.
|
||||
dnl
|
||||
dnl
|
||||
dnl Changing ac_cv_sizeof___int128_t here doesn't corret SIZEOF___INT128_T
|
||||
dnl since it's already generated. It only affects HIO_SIZEOF___INT128_T below.
|
||||
if test ${ac_cv_sizeof___int128_t} -gt 0
|
||||
@ -672,7 +679,13 @@ then
|
||||
)
|
||||
fi
|
||||
|
||||
dnl Some compilers doesn't seem to have full support for __float128
|
||||
dnl if quamath is not enabled, zero the sizeof float128
|
||||
if test "x${enable_quadmath_is}" == "xno"
|
||||
then
|
||||
ac_cv_sizeof___float128=0
|
||||
fi
|
||||
|
||||
dnl Some compilers doesn't seem to have full support for __float128
|
||||
dnl even if the type is available.
|
||||
if test ${ac_cv_sizeof___float128} -gt 0
|
||||
then
|
||||
@ -684,7 +697,6 @@ then
|
||||
]])],[AC_MSG_RESULT(yes)],[
|
||||
AC_MSG_RESULT(no)
|
||||
ac_cv_sizeof___float128=0
|
||||
|
||||
])
|
||||
fi
|
||||
|
||||
@ -700,10 +712,10 @@ then
|
||||
LIBS="$LIBM $LIBS"
|
||||
AC_CHECK_FUNCS([quadmath_snprintf])
|
||||
LIBS="$OLDLIBS"
|
||||
|
||||
|
||||
if test "$ac_cv_func_quadmath_snprintf" = "no"
|
||||
then
|
||||
dnl quadmath_snprintf not avalable in the
|
||||
dnl quadmath_snprintf not avalable in the
|
||||
dnl standard math lib.
|
||||
|
||||
AC_CHECK_LIB([quadmath], [quadmath_snprintf], [
|
||||
@ -714,7 +726,7 @@ then
|
||||
|
||||
if test "$ac_cv_lib_quadmath_quadmath_snprintf" = "no"
|
||||
then
|
||||
dnl quadmath_snprintf not avalable in the
|
||||
dnl quadmath_snprintf not avalable in the
|
||||
dnl quadmath lib.
|
||||
|
||||
ac_cv_sizeof___float128=0
|
||||
@ -807,7 +819,7 @@ else
|
||||
AC_SUBST(BUILD_MODE, "release")
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE([wide-char],
|
||||
AC_ARG_ENABLE([wide-char],
|
||||
[AS_HELP_STRING([--enable-wide-char],[Use the wide-character type as the default character type. one of yes, no, yes:2, yes:4, no:2, no:4 (default. yes)])],
|
||||
enable_wide_char_is=$enableval,
|
||||
enable_wide_char_is=yes
|
||||
@ -819,7 +831,7 @@ then
|
||||
if test "${platform_win32}" = "yes"
|
||||
then
|
||||
[CFLAGS="$CFLAGS -DUNICODE -D_UNICODE"]
|
||||
fi
|
||||
fi
|
||||
elif test "${enable_wide_char_is}" = "yes:2"
|
||||
then
|
||||
AC_DEFINE([HIO_WIDE_CHAR_SIZE],[2],[Wide-character type size])
|
||||
@ -878,9 +890,9 @@ AC_SUBST(HIO_PROJECT_AUTHOR, "${PACKAGE_BUGREPORT}")
|
||||
AC_SUBST(HIO_PROJECT_URL, "${PACKAGE_URL}")
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
Makefile
|
||||
Dockerfile
|
||||
lib/Makefile
|
||||
lib/Makefile
|
||||
bin/Makefile
|
||||
t/Makefile
|
||||
pkgs/hio.spec
|
||||
@ -888,7 +900,7 @@ AC_CONFIG_FILES([
|
||||
AC_OUTPUT
|
||||
|
||||
[
|
||||
echo
|
||||
echo
|
||||
echo "-[SUMMARY]---------------------------------------------------------------"
|
||||
echo "Configured for ${host}"
|
||||
echo " Build mode : ${BUILD_MODE}"
|
||||
|
@ -3,7 +3,7 @@ AUTOMAKE_OPTIONS = nostdinc
|
||||
CPPFLAGS_ALL_COMMON = \
|
||||
-I$(abs_builddir) \
|
||||
-I$(abs_srcdir) \
|
||||
-I$(includedir)
|
||||
-I$(includedir)
|
||||
|
||||
CFLAGS_ALL_COMMON =
|
||||
LDFLAGS_ALL_COMMON = -L$(abs_builddir) -L$(libdir)
|
||||
@ -15,10 +15,10 @@ EXTRA_DIST = \
|
||||
|
||||
BUILT_SOURCES = \
|
||||
hio-str.h \
|
||||
utl-str.c
|
||||
utl-str.c
|
||||
|
||||
##################################################
|
||||
# MAIN LIBRARY
|
||||
# MAIN LIBRARY
|
||||
##################################################
|
||||
|
||||
CPPFLAGS_LIB_COMMON = $(CPPFLAGS_ALL_COMMON)
|
||||
@ -146,7 +146,7 @@ endif
|
||||
install-data-hook:
|
||||
@echo "#ifndef _HIO_CFG_H_" > "$(DESTDIR)$(includedir)/hio-cfg.h"
|
||||
@echo "#define _HIO_CFG_H_" >> "$(DESTDIR)$(includedir)/hio-cfg.h"
|
||||
@$(EGREP) "#define[ ]+HIO_" "$(abs_builddir)/hio-cfg.h" >> "$(DESTDIR)$(includedir)/hio-cfg.h"
|
||||
@$(EGREP) "#define[ ]+HIO_" "$(abs_builddir)/hio-cfg.h" >> "$(DESTDIR)$(includedir)/hio-cfg.h"
|
||||
@echo "#endif" >> "$(DESTDIR)$(includedir)/hio-cfg.h"
|
||||
@rm -f "$(DESTDIR)$(includedir)/hio-cfg.h.in"
|
||||
@$(SED) 's|/\*#define HIO_HAVE_CFG_H\*/|#define HIO_HAVE_CFG_H|' "$(srcdir)/hio-cmn.h" > "$(DESTDIR)$(includedir)/hio-cmn.h"
|
||||
@ -157,6 +157,6 @@ uninstall-hook:
|
||||
hio-str.h: utl-str.m4 hio-str.h.m4
|
||||
m4 -I$(srcdir) $(srcdir)/hio-str.h.m4 > $(srcdir)/hio-str.h
|
||||
|
||||
utl-str.c: utl-str.m4 utl-str.c.m4
|
||||
utl-str.c: utl-str.m4 utl-str.c.m4
|
||||
m4 -I$(srcdir) $(srcdir)/utl-str.c.m4 > $(srcdir)/utl-str.c
|
||||
|
||||
|
@ -438,7 +438,7 @@ AUTOMAKE_OPTIONS = nostdinc
|
||||
CPPFLAGS_ALL_COMMON = \
|
||||
-I$(abs_builddir) \
|
||||
-I$(abs_srcdir) \
|
||||
-I$(includedir)
|
||||
-I$(includedir)
|
||||
|
||||
CFLAGS_ALL_COMMON =
|
||||
LDFLAGS_ALL_COMMON = -L$(abs_builddir) -L$(libdir)
|
||||
@ -449,11 +449,11 @@ EXTRA_DIST = \
|
||||
|
||||
BUILT_SOURCES = \
|
||||
hio-str.h \
|
||||
utl-str.c
|
||||
utl-str.c
|
||||
|
||||
|
||||
##################################################
|
||||
# MAIN LIBRARY
|
||||
# MAIN LIBRARY
|
||||
##################################################
|
||||
CPPFLAGS_LIB_COMMON = $(CPPFLAGS_ALL_COMMON)
|
||||
CFLAGS_LIB_COMMON = $(CFLAGS_ALL_COMMON)
|
||||
@ -1352,7 +1352,7 @@ uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
|
||||
install-data-hook:
|
||||
@echo "#ifndef _HIO_CFG_H_" > "$(DESTDIR)$(includedir)/hio-cfg.h"
|
||||
@echo "#define _HIO_CFG_H_" >> "$(DESTDIR)$(includedir)/hio-cfg.h"
|
||||
@$(EGREP) "#define[ ]+HIO_" "$(abs_builddir)/hio-cfg.h" >> "$(DESTDIR)$(includedir)/hio-cfg.h"
|
||||
@$(EGREP) "#define[ ]+HIO_" "$(abs_builddir)/hio-cfg.h" >> "$(DESTDIR)$(includedir)/hio-cfg.h"
|
||||
@echo "#endif" >> "$(DESTDIR)$(includedir)/hio-cfg.h"
|
||||
@rm -f "$(DESTDIR)$(includedir)/hio-cfg.h.in"
|
||||
@$(SED) 's|/\*#define HIO_HAVE_CFG_H\*/|#define HIO_HAVE_CFG_H|' "$(srcdir)/hio-cmn.h" > "$(DESTDIR)$(includedir)/hio-cmn.h"
|
||||
@ -1363,7 +1363,7 @@ uninstall-hook:
|
||||
hio-str.h: utl-str.m4 hio-str.h.m4
|
||||
m4 -I$(srcdir) $(srcdir)/hio-str.h.m4 > $(srcdir)/hio-str.h
|
||||
|
||||
utl-str.c: utl-str.m4 utl-str.c.m4
|
||||
utl-str.c: utl-str.m4 utl-str.c.m4
|
||||
m4 -I$(srcdir) $(srcdir)/utl-str.c.m4 > $(srcdir)/utl-str.c
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
|
@ -47,11 +47,11 @@ int hio_dhcp4_init_pktbuf (hio_dhcp4_pktbuf_t* pkt, void* buf, hio_oow_t capa)
|
||||
int hio_dhcp4_add_option (hio_dhcp4_pktbuf_t* pkt, int code, void* optr, hio_uint8_t olen)
|
||||
{
|
||||
hio_dhcp4_opt_hdr_t* opthdr;
|
||||
magic_cookie_t* cookie;
|
||||
magic_cookie_t* cookie;
|
||||
int optlen;
|
||||
|
||||
/* TODO: support to override sname and file */
|
||||
if (pkt->len < HIO_SIZEOF(*pkt->hdr) || pkt->capa < pkt->len)
|
||||
if (pkt->len < HIO_SIZEOF(*pkt->hdr) || pkt->capa < pkt->len)
|
||||
{
|
||||
/* the pktbuf_t structure got messy */
|
||||
return -1;
|
||||
@ -139,13 +139,13 @@ static hio_uint8_t* get_option_start (const hio_dhcp4_pkt_hdr_t* pkt, hio_oow_t
|
||||
hio_oow_t optlen;
|
||||
|
||||
/* check if a packet is large enough to hold the known header */
|
||||
if (len < HIO_SIZEOF(hio_dhcp4_pkt_hdr_t)) return HIO_NULL;
|
||||
if (len < HIO_SIZEOF(hio_dhcp4_pkt_hdr_t)) return HIO_NULL;
|
||||
|
||||
/* get the length of option fields */
|
||||
optlen = len - HIO_SIZEOF(hio_dhcp4_pkt_hdr_t);
|
||||
|
||||
/* check if a packet is large enough to have a magic cookie */
|
||||
if (optlen < HIO_SIZEOF(*cookie)) return HIO_NULL;
|
||||
if (optlen < HIO_SIZEOF(*cookie)) return HIO_NULL;
|
||||
|
||||
/* get the pointer to the beginning of options */
|
||||
cookie = (magic_cookie_t*)(pkt + 1);
|
||||
@ -186,7 +186,7 @@ int hio_dhcp4_walk_options (const hio_dhcp4_pktinf_t* pkt, hio_dhcp4_opt_walker_
|
||||
opt += HIO_SIZEOF(*opthdr);
|
||||
|
||||
/* no len field exists for PADDING and END */
|
||||
if (opthdr->code == HIO_DHCP4_OPT_PADDING) continue;
|
||||
if (opthdr->code == HIO_DHCP4_OPT_PADDING) continue;
|
||||
if (opthdr->code == HIO_DHCP4_OPT_END) break;
|
||||
|
||||
if (opt + opthdr->len >= end) return -1; /* the length field is wrong */
|
||||
@ -337,7 +337,7 @@ hio_dhcp6_opt_hdr_t* hio_dhcp6_find_option (const hio_dhcp6_pktinf_t* pkt, int c
|
||||
|
||||
while (rem >= HIO_SIZEOF(hio_dhcp6_opt_hdr_t))
|
||||
{
|
||||
if (hio_ntoh16(opt->code) == code)
|
||||
if (hio_ntoh16(opt->code) == code)
|
||||
{
|
||||
if (rem - HIO_SIZEOF(hio_dhcp6_opt_hdr_t) < hio_ntoh16(opt->len)) return HIO_NULL; /* probably the packet is ill-formed */
|
||||
return opt;
|
||||
@ -347,7 +347,7 @@ hio_dhcp6_opt_hdr_t* hio_dhcp6_find_option (const hio_dhcp6_pktinf_t* pkt, int c
|
||||
if (rem < opt_len) break;
|
||||
rem -= opt_len;
|
||||
opt = (hio_dhcp6_opt_hdr_t*)((hio_uint8_t*)(opt + 1) + hio_ntoh16(opt->len));
|
||||
|
||||
|
||||
}
|
||||
|
||||
return HIO_NULL;
|
||||
|
@ -255,7 +255,7 @@ static int sck_on_read (hio_dev_sck_t* sck, const void* data, hio_iolen_t dlen,
|
||||
/* the complete body is in conn->r.buf */
|
||||
if (conn->r.type == HIO_FCGI_END_REQUEST)
|
||||
{
|
||||
hio_fcgi_end_request_body_t* erb = conn->r.buf;
|
||||
hio_fcgi_end_request_body_t* erb = (hio_fcgi_end_request_body_t*)conn->r.buf;
|
||||
|
||||
if (erb->proto_status != HIO_FCGI_REQUEST_COMPLETE)
|
||||
{
|
||||
|
@ -286,7 +286,7 @@ static void cgi_peer_on_close (hio_dev_pro_t* pro, hio_dev_pro_sid_t sid)
|
||||
|
||||
if (!(cgi->over & CGI_OVER_READ_FROM_PEER))
|
||||
{
|
||||
if (hio_svc_htts_task_endbody(cgi) <= -1)
|
||||
if (hio_svc_htts_task_endbody((hio_svc_htts_task_t*)cgi) <= -1)
|
||||
cgi_halt_participating_devices (cgi);
|
||||
else
|
||||
cgi_mark_over (cgi, CGI_OVER_READ_FROM_PEER);
|
||||
@ -331,7 +331,7 @@ static int cgi_peer_on_read (hio_dev_pro_t* pro, hio_dev_pro_sid_t sid, const vo
|
||||
/* the cgi script could be misbehaving.
|
||||
* it still has to read more but EOF is read.
|
||||
* otherwise peer_htrd_poke() should have been called */
|
||||
n = hio_svc_htts_task_endbody(cgi);
|
||||
n = hio_svc_htts_task_endbody((hio_svc_htts_task_t*)cgi);
|
||||
cgi_mark_over (cgi, CGI_OVER_READ_FROM_PEER);
|
||||
if (n <= -1) goto oops;
|
||||
}
|
||||
@ -348,7 +348,7 @@ static int cgi_peer_on_read (hio_dev_pro_t* pro, hio_dev_pro_sid_t sid, const vo
|
||||
|
||||
if (!cgi->task_res_started && !(cgi->over & CGI_OVER_WRITE_TO_CLIENT))
|
||||
{
|
||||
hio_svc_htts_task_sendfinalres (cgi, HIO_HTTP_STATUS_BAD_GATEWAY, HIO_NULL, HIO_NULL, 1); /* don't care about error because it jumps to oops below anyway */
|
||||
hio_svc_htts_task_sendfinalres ((hio_svc_htts_task_t*)cgi, HIO_HTTP_STATUS_BAD_GATEWAY, HIO_NULL, HIO_NULL, 1); /* don't care about error because it jumps to oops below anyway */
|
||||
}
|
||||
|
||||
goto oops;
|
||||
@ -421,7 +421,7 @@ oops:
|
||||
|
||||
static int peer_capture_response_header (hio_htre_t* req, const hio_bch_t* key, const hio_htre_hdrval_t* val, void* ctx)
|
||||
{
|
||||
return hio_svc_htts_task_addreshdrs((cgi_t*)ctx, key, val);
|
||||
return hio_svc_htts_task_addreshdrs((hio_svc_htts_task_t*)(cgi_t*)ctx, key, val);
|
||||
}
|
||||
|
||||
static int peer_htrd_peek (hio_htrd_t* htrd, hio_htre_t* req)
|
||||
@ -440,9 +440,9 @@ static int peer_htrd_peek (hio_htrd_t* htrd, hio_htre_t* req)
|
||||
|
||||
chunked = cgi->task_keep_client_alive && !req->attr.content_length;
|
||||
|
||||
if (hio_svc_htts_task_startreshdr(cgi, status_code, status_desc, chunked) <= -1 ||
|
||||
if (hio_svc_htts_task_startreshdr((hio_svc_htts_task_t*)cgi, status_code, status_desc, chunked) <= -1 ||
|
||||
hio_htre_walkheaders(req, peer_capture_response_header, cgi) <= -1 ||
|
||||
hio_svc_htts_task_endreshdr(cgi) <= -1) return -1;
|
||||
hio_svc_htts_task_endreshdr((hio_svc_htts_task_t*)cgi) <= -1) return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -455,7 +455,7 @@ static int peer_htrd_poke (hio_htrd_t* htrd, hio_htre_t* req)
|
||||
cgi_t* cgi = peer->cgi;
|
||||
int n;
|
||||
|
||||
n = hio_svc_htts_task_endbody(cgi);
|
||||
n = hio_svc_htts_task_endbody((hio_svc_htts_task_t*)cgi);
|
||||
cgi_mark_over (cgi, CGI_OVER_READ_FROM_PEER);
|
||||
return n;
|
||||
}
|
||||
@ -468,7 +468,7 @@ static int peer_htrd_push_content (hio_htrd_t* htrd, hio_htre_t* req, const hio_
|
||||
|
||||
HIO_ASSERT (cgi->htts->hio, htrd == cgi->peer_htrd);
|
||||
|
||||
n = hio_svc_htts_task_addresbody(cgi, data, dlen);
|
||||
n = hio_svc_htts_task_addresbody((hio_svc_htts_task_t*)cgi, data, dlen);
|
||||
if (cgi->task_res_pending_writes > CGI_PENDING_IO_THRESHOLD)
|
||||
{
|
||||
if (hio_dev_pro_read(cgi->peer, HIO_DEV_PRO_OUT, 0) <= -1) n = -1;
|
||||
@ -1036,7 +1036,7 @@ int hio_svc_htts_docgi (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* r
|
||||
}
|
||||
bound_to_peer = 1;
|
||||
|
||||
if (hio_svc_htts_task_handleexpect100(cgi, 0) <= -1) goto oops;
|
||||
if (hio_svc_htts_task_handleexpect100((hio_svc_htts_task_t*)cgi, 0) <= -1) goto oops;
|
||||
if (setup_for_content_length(cgi, req) <= -1) goto oops;
|
||||
|
||||
/* TODO: store current input watching state and use it when destroying the cgi data */
|
||||
@ -1055,7 +1055,7 @@ oops:
|
||||
HIO_DEBUG3 (hio, "HTTS(%p) - FAILURE in docgi - socket(%p) - %js\n", htts, csck, hio_geterrmsg(hio));
|
||||
if (cgi)
|
||||
{
|
||||
hio_svc_htts_task_sendfinalres(cgi, status_code, HIO_NULL, HIO_NULL, 1);
|
||||
hio_svc_htts_task_sendfinalres((hio_svc_htts_task_t*)cgi, status_code, HIO_NULL, HIO_NULL, 1);
|
||||
if (bound_to_peer) unbind_task_from_peer (cgi, 1);
|
||||
if (bound_to_client) unbind_task_from_client (cgi, 1);
|
||||
cgi_halt_participating_devices (cgi);
|
||||
|
@ -177,7 +177,7 @@ static void fcgi_peer_on_untie (hio_svc_fcgic_sess_t* peer, void* ctx)
|
||||
HIO_DEBUG5 (hio, "HTTS(%p) - fcgi(t=%p,c=%p[%d],p=%p) - untieing peer\n", fcgi->htts, fcgi, fcgi->task_client, (fcgi->task_csck? fcgi->task_csck->hnd: -1), fcgi->peer);
|
||||
|
||||
fcgi->peer = HIO_NULL; /* to avoid infinite loop as explained above */
|
||||
hio_svc_htts_task_endbody (fcgi);
|
||||
hio_svc_htts_task_endbody ((hio_svc_htts_task_t*)fcgi);
|
||||
unbind_task_from_peer (fcgi, 1);
|
||||
|
||||
HIO_DEBUG5 (hio, "HTTS(%p) - fcgi(t=%p,c=%p[%d],p=%p) - untied peer\n", fcgi->htts, fcgi, fcgi->task_client, (fcgi->task_csck? fcgi->task_csck->hnd: -1), fcgi->peer);
|
||||
@ -205,7 +205,7 @@ static int fcgi_peer_on_read (hio_svc_fcgic_sess_t* peer, const void* data, hio_
|
||||
/* the fcgi script could be misbehaving.
|
||||
* it still has to read more but EOF is read.
|
||||
* otherwise peer_htrd_poke() should have been called */
|
||||
n = hio_svc_htts_task_endbody(fcgi);
|
||||
n = hio_svc_htts_task_endbody((hio_svc_htts_task_t*)fcgi);
|
||||
fcgi_mark_over (fcgi, FCGI_OVER_READ_FROM_PEER);
|
||||
if (n <= -1) goto oops;
|
||||
}
|
||||
@ -222,7 +222,7 @@ static int fcgi_peer_on_read (hio_svc_fcgic_sess_t* peer, const void* data, hio_
|
||||
|
||||
if (!fcgi->task_res_started && !(fcgi->over & FCGI_OVER_WRITE_TO_CLIENT))
|
||||
{
|
||||
hio_svc_htts_task_sendfinalres (fcgi, HIO_HTTP_STATUS_BAD_GATEWAY, HIO_NULL, HIO_NULL, 1); /* don't care about error because it jumps to oops below anyway */
|
||||
hio_svc_htts_task_sendfinalres ((hio_svc_htts_task_t*)fcgi, HIO_HTTP_STATUS_BAD_GATEWAY, HIO_NULL, HIO_NULL, 1); /* don't care about error because it jumps to oops below anyway */
|
||||
}
|
||||
|
||||
goto oops;
|
||||
@ -284,9 +284,9 @@ static int peer_htrd_peek (hio_htrd_t* htrd, hio_htre_t* req)
|
||||
|
||||
chunked = fcgi->task_keep_client_alive && !req->attr.content_length;
|
||||
|
||||
if (hio_svc_htts_task_startreshdr(fcgi, status_code, status_desc, chunked) <= -1 ||
|
||||
if (hio_svc_htts_task_startreshdr((hio_svc_htts_task_t*)fcgi, status_code, status_desc, chunked) <= -1 ||
|
||||
hio_htre_walkheaders(req, peer_capture_response_header, fcgi) <= -1 ||
|
||||
hio_svc_htts_task_endreshdr(fcgi) <= -1) return -1;
|
||||
hio_svc_htts_task_endreshdr((hio_svc_htts_task_t*)fcgi) <= -1) return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -299,7 +299,7 @@ static int peer_htrd_poke (hio_htrd_t* htrd, hio_htre_t* req)
|
||||
fcgi_t* fcgi = peer->fcgi;
|
||||
int n;
|
||||
|
||||
n = hio_svc_htts_task_endbody(fcgi);
|
||||
n = hio_svc_htts_task_endbody((hio_svc_htts_task_t*)fcgi);
|
||||
fcgi_mark_over (fcgi, FCGI_OVER_READ_FROM_PEER);
|
||||
return n;
|
||||
}
|
||||
@ -309,7 +309,7 @@ static int peer_htrd_push_content (hio_htrd_t* htrd, hio_htre_t* req, const hio_
|
||||
fcgi_peer_xtn_t* peer = hio_htrd_getxtn(htrd);
|
||||
fcgi_t* fcgi = peer->fcgi;
|
||||
HIO_ASSERT (fcgi->htts->hio, htrd == fcgi->peer_htrd);
|
||||
return hio_svc_htts_task_addresbody(fcgi, data, dlen);
|
||||
return hio_svc_htts_task_addresbody((hio_svc_htts_task_t*)fcgi, data, dlen);
|
||||
}
|
||||
|
||||
static hio_htrd_recbs_t peer_htrd_recbs =
|
||||
@ -786,7 +786,7 @@ int hio_svc_htts_dofcgi (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t*
|
||||
if (bind_task_to_peer(fcgi, fcgis_addr) <= -1) goto oops;
|
||||
bound_to_peer = 1;
|
||||
|
||||
if (hio_svc_htts_task_handleexpect100(fcgi, 0) <= -1) goto oops;
|
||||
if (hio_svc_htts_task_handleexpect100((hio_svc_htts_task_t*)fcgi, 0) <= -1) goto oops;
|
||||
if (setup_for_content_length(fcgi, req) <= -1) goto oops;
|
||||
|
||||
/* TODO: store current input watching state and use it when destroying the fcgi data */
|
||||
@ -810,7 +810,7 @@ oops:
|
||||
HIO_DEBUG2 (hio, "HTTS(%p) - FAILURE in dofcgi - socket(%p)\n", htts, csck);
|
||||
if (fcgi)
|
||||
{
|
||||
hio_svc_htts_task_sendfinalres(fcgi, status_code, HIO_NULL, HIO_NULL, 1);
|
||||
hio_svc_htts_task_sendfinalres((hio_svc_htts_task_t*)fcgi, status_code, HIO_NULL, HIO_NULL, 1);
|
||||
if (bound_to_peer) unbind_task_from_peer (fcgi, 1);
|
||||
if (bound_to_client) unbind_task_from_client (fcgi, 1);
|
||||
fcgi_halt_participating_devices (fcgi);
|
||||
|
@ -945,7 +945,7 @@ oops:
|
||||
HIO_DEBUG2 (hio, "HTTS(%p) - file(c=%d) failure\n", htts, csck->hnd);
|
||||
if (file)
|
||||
{
|
||||
hio_svc_htts_task_sendfinalres(file, status_code, HIO_NULL, HIO_NULL, 1);
|
||||
hio_svc_htts_task_sendfinalres((hio_svc_htts_task_t*)file, status_code, HIO_NULL, HIO_NULL, 1);
|
||||
if (bound_to_peer) unbind_task_from_peer (file, 0);
|
||||
if (bound_to_client) unbind_task_from_client (file, 0);
|
||||
file_halt_participating_devices (file);
|
||||
|
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "http-prv.h"
|
||||
#include <hio-pro.h>
|
||||
#include <hio-sck.h>
|
||||
#include <hio-fmt.h>
|
||||
#include <hio-chr.h>
|
||||
#include <hio-dns.h>
|
||||
@ -56,7 +56,7 @@ struct prxy_t
|
||||
|
||||
int options;
|
||||
hio_oow_t peer_pending_writes;
|
||||
hio_dev_pro_t* peer;
|
||||
hio_dev_sck_t* peer;
|
||||
hio_htrd_t* peer_htrd;
|
||||
|
||||
unsigned int over: 4; /* must be large enough to accomodate PRXY_OVER_ALL */
|
||||
@ -85,7 +85,7 @@ static void prxy_halt_participating_devices (prxy_t* prxy)
|
||||
if (prxy->task_csck) hio_dev_sck_halt (prxy->task_csck);
|
||||
|
||||
/* check for peer as it may not have been started */
|
||||
if (prxy->peer) hio_dev_pro_halt (prxy->peer);
|
||||
if (prxy->peer) hio_dev_sck_halt (prxy->peer);
|
||||
}
|
||||
|
||||
static int prxy_write_to_peer (prxy_t* prxy, const void* data, hio_iolen_t dlen)
|
||||
@ -93,7 +93,7 @@ static int prxy_write_to_peer (prxy_t* prxy, const void* data, hio_iolen_t dlen)
|
||||
if (prxy->peer)
|
||||
{
|
||||
prxy->peer_pending_writes++;
|
||||
if (hio_dev_pro_write(prxy->peer, data, dlen, HIO_NULL) <= -1)
|
||||
if (hio_dev_sck_write(prxy->peer, data, dlen, HIO_NULL, HIO_NULL) <= -1)
|
||||
{
|
||||
prxy->peer_pending_writes--;
|
||||
return -1;
|
||||
@ -130,10 +130,10 @@ static HIO_INLINE void prxy_mark_over (prxy_t* prxy, int over_bits)
|
||||
|
||||
if (!(old_over & PRXY_OVER_READ_FROM_PEER) && (prxy->over & PRXY_OVER_READ_FROM_PEER))
|
||||
{
|
||||
if (prxy->peer && hio_dev_pro_read(prxy->peer, HIO_DEV_PRO_OUT, 0) <= -1)
|
||||
if (prxy->peer && hio_dev_sck_read(prxy->peer, 0) <= -1)
|
||||
{
|
||||
HIO_DEBUG5 (hio, "HTTS(%p) - prxy(t=%p,c=%p[%d],p=%p) - halting peer for failure to disable input watching\n", prxy->htts, prxy, prxy->task_client, (prxy->task_csck? prxy->task_csck->hnd: -1), prxy->peer);
|
||||
hio_dev_pro_halt (prxy->peer);
|
||||
hio_dev_sck_halt (prxy->peer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ static HIO_INLINE void prxy_mark_over (prxy_t* prxy, int over_bits)
|
||||
if (prxy->peer)
|
||||
{
|
||||
HIO_DEBUG5 (hio, "HTTS(%p) - prxy(t=%p,c=%p[%d],p=%p) - halting unneeded peer\n", prxy->htts, prxy, prxy->task_client, (prxy->task_csck? prxy->task_csck->hnd: -1), prxy->peer);
|
||||
hio_dev_pro_halt (prxy->peer);
|
||||
hio_dev_sck_halt (prxy->peer);
|
||||
}
|
||||
|
||||
if (prxy->task_csck)
|
||||
@ -249,7 +249,7 @@ static int prxy_peer_on_read (hio_dev_sck_t* sck, const void* data, hio_iolen_t
|
||||
/* the prxy script could be misbehaving.
|
||||
* it still has to read more but EOF is read.
|
||||
* otherwise peer_htrd_poke() should have been called */
|
||||
n = hio_svc_htts_task_endbody(prxy);
|
||||
n = hio_svc_htts_task_endbody((hio_svc_htts_task_t*)prxy);
|
||||
prxy_mark_over (prxy, PRXY_OVER_READ_FROM_PEER);
|
||||
if (n <= -1) goto oops;
|
||||
}
|
||||
@ -266,7 +266,7 @@ static int prxy_peer_on_read (hio_dev_sck_t* sck, const void* data, hio_iolen_t
|
||||
|
||||
if (!prxy->task_res_started && !(prxy->over & PRXY_OVER_WRITE_TO_CLIENT))
|
||||
{
|
||||
hio_svc_htts_task_sendfinalres (prxy, HIO_HTTP_STATUS_BAD_GATEWAY, HIO_NULL, HIO_NULL, 1); /* don't care about error because it jumps to oops below anyway */
|
||||
hio_svc_htts_task_sendfinalres ((hio_svc_htts_task_t*)prxy, HIO_HTTP_STATUS_BAD_GATEWAY, HIO_NULL, HIO_NULL, 1); /* don't care about error because it jumps to oops below anyway */
|
||||
}
|
||||
|
||||
goto oops;
|
||||
@ -288,7 +288,7 @@ oops:
|
||||
static int prxy_peer_on_write (hio_dev_sck_t* sck, hio_iolen_t wrlen, void* wrctx, const hio_skad_t* dstaddr)
|
||||
{
|
||||
hio_t* hio = sck->hio;
|
||||
prxy_peer_xtn_t* peer = hio_dev_pro_getxtn(sck);
|
||||
prxy_peer_xtn_t* peer = hio_dev_sck_getxtn(sck);
|
||||
prxy_t* prxy = peer->prxy;
|
||||
|
||||
if (!prxy) return 0; /* there is nothing i can do. the prxy is being cleared or has been cleared already. */
|
||||
@ -339,7 +339,7 @@ oops:
|
||||
|
||||
static int peer_capture_response_header (hio_htre_t* req, const hio_bch_t* key, const hio_htre_hdrval_t* val, void* ctx)
|
||||
{
|
||||
return hio_svc_htts_task_addreshdrs((prxy_t*)ctx, key, val);
|
||||
return hio_svc_htts_task_addreshdrs((hio_svc_htts_task_t*)(prxy_t*)ctx, key, val);
|
||||
}
|
||||
|
||||
static int peer_htrd_peek (hio_htrd_t* htrd, hio_htre_t* req)
|
||||
@ -358,9 +358,9 @@ static int peer_htrd_peek (hio_htrd_t* htrd, hio_htre_t* req)
|
||||
|
||||
chunked = prxy->task_keep_client_alive && !req->attr.content_length;
|
||||
|
||||
if (hio_svc_htts_task_startreshdr(prxy, status_code, status_desc, chunked) <= -1 ||
|
||||
if (hio_svc_htts_task_startreshdr((hio_svc_htts_task_t*)prxy, status_code, status_desc, chunked) <= -1 ||
|
||||
hio_htre_walkheaders(req, peer_capture_response_header, prxy) <= -1 ||
|
||||
hio_svc_htts_task_endreshdr(prxy) <= -1) return -1;
|
||||
hio_svc_htts_task_endreshdr((hio_svc_htts_task_t*)prxy) <= -1) return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -373,7 +373,7 @@ static int peer_htrd_poke (hio_htrd_t* htrd, hio_htre_t* req)
|
||||
prxy_t* prxy = peer->prxy;
|
||||
int n;
|
||||
|
||||
n = hio_svc_htts_task_endbody(prxy);
|
||||
n = hio_svc_htts_task_endbody((hio_svc_htts_task_t*)prxy);
|
||||
prxy_mark_over (prxy, PRXY_OVER_READ_FROM_PEER);
|
||||
return n;
|
||||
}
|
||||
@ -386,10 +386,10 @@ static int peer_htrd_push_content (hio_htrd_t* htrd, hio_htre_t* req, const hio_
|
||||
|
||||
HIO_ASSERT (prxy->htts->hio, htrd == prxy->peer_htrd);
|
||||
|
||||
n = hio_svc_htts_task_addresbody(prxy, data, dlen);
|
||||
n = hio_svc_htts_task_addresbody((hio_svc_htts_task_t*)prxy, data, dlen);
|
||||
if (prxy->task_res_pending_writes > PRXY_PENDING_IO_THRESHOLD)
|
||||
{
|
||||
if (hio_dev_pro_read(prxy->peer, HIO_DEV_PRO_OUT, 0) <= -1) n = -1;
|
||||
if (hio_dev_sck_read(prxy->peer, 0) <= -1) n = -1;
|
||||
}
|
||||
|
||||
return n;
|
||||
@ -447,7 +447,7 @@ static void prxy_client_on_disconnect (hio_dev_sck_t* sck)
|
||||
|
||||
if (prxy)
|
||||
{
|
||||
HIO_SVC_HTTS_TASK_RCUP (prxy);
|
||||
HIO_SVC_HTTS_TASK_RCUP ((hio_svc_htts_task_t*)prxy);
|
||||
|
||||
/* detach the task from the client and the client socket */
|
||||
unbind_task_from_client (prxy, 1);
|
||||
@ -456,7 +456,7 @@ static void prxy_client_on_disconnect (hio_dev_sck_t* sck)
|
||||
/*if (fprxy->client_org_on_disconnect) fprxy->client_org_on_disconnect (sck);*/
|
||||
if (sck->on_disconnect) sck->on_disconnect (sck); /* restored to the orginal parent handler in unbind_task_from_client() */
|
||||
|
||||
HIO_SVC_HTTS_TASK_RCDOWN (prxy);
|
||||
HIO_SVC_HTTS_TASK_RCDOWN ((hio_svc_htts_task_t*)prxy);
|
||||
}
|
||||
|
||||
HIO_DEBUG4 (hio, "HTTS(%p) - prxy(t=%p,c=%p,csck=%p) - client socket disconnect handled\n", htts, prxy, cli, sck);
|
||||
@ -527,7 +527,7 @@ static int prxy_client_on_write (hio_dev_sck_t* sck, hio_iolen_t wrlen, void* wr
|
||||
{
|
||||
/* enable input watching */
|
||||
if (!(prxy->over & PRXY_OVER_READ_FROM_PEER) &&
|
||||
hio_dev_pro_read(prxy->peer, HIO_DEV_PRO_OUT, 1) <= -1) n = -1;
|
||||
hio_dev_sck_read(prxy->peer, 1) <= -1) n = -1;
|
||||
}
|
||||
|
||||
if ((prxy->over & PRXY_OVER_READ_FROM_PEER) && prxy->task_res_pending_writes <= 0)
|
||||
@ -591,7 +591,7 @@ static int peer_capture_request_header (hio_htre_t* req, const hio_bch_t* key, c
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int prxy_peer_on_fork (hio_dev_pro_t* pro, void* fork_ctx)
|
||||
static int prxy_peer_on_fork (hio_dev_sck_t* pro, void* fork_ctx)
|
||||
{
|
||||
hio_t* hio = pro->hio; /* in this callback, the pro device is not fully up. however, the hio field is guaranteed to be available */
|
||||
peer_fork_ctx_t* fc = (peer_fork_ctx_t*)fork_ctx;
|
||||
@ -837,7 +837,7 @@ static int bind_task_to_peer (prxy_t* prxy, hio_dev_sck_t* csck, hio_htre_t* req
|
||||
prxy->peer = sck;
|
||||
prxy->peer_htrd = htrd;
|
||||
|
||||
pxtn = hio_dev_pro_getxtn(prxy->peer);
|
||||
pxtn = hio_dev_sck_getxtn(prxy->peer);
|
||||
pxtn->prxy = prxy;
|
||||
HIO_SVC_HTTS_TASK_RCUP (prxy);
|
||||
|
||||
@ -867,10 +867,10 @@ static void unbind_task_from_peer (prxy_t* prxy, int rcdown)
|
||||
if (prxy->peer)
|
||||
{
|
||||
prxy_peer_xtn_t* peer_xtn;
|
||||
peer_xtn = hio_dev_pro_getxtn(prxy->peer);
|
||||
peer_xtn = hio_dev_sck_getxtn(prxy->peer);
|
||||
peer_xtn->prxy = HIO_NULL;
|
||||
|
||||
hio_dev_pro_kill (prxy->peer);
|
||||
hio_dev_sck_kill (prxy->peer);
|
||||
prxy->peer = HIO_NULL;
|
||||
n++;
|
||||
}
|
||||
@ -947,12 +947,12 @@ int hio_svc_htts_doprxy (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t*
|
||||
|
||||
if ((n = bind_task_to_peer(prxy, csck, req, tgt_addr)) <= -1)
|
||||
{
|
||||
hio_svc_htts_task_sendfinalres(prxy, (n == 2? HIO_HTTP_STATUS_FORBIDDEN: HIO_HTTP_STATUS_INTERNAL_SERVER_ERROR), HIO_NULL, HIO_NULL, 1);
|
||||
hio_svc_htts_task_sendfinalres((hio_svc_htts_task_t*)prxy, (n == 2? HIO_HTTP_STATUS_FORBIDDEN: HIO_HTTP_STATUS_INTERNAL_SERVER_ERROR), HIO_NULL, HIO_NULL, 1);
|
||||
goto oops; /* TODO: must not go to oops. just destroy the prxy and finalize the request .. */
|
||||
}
|
||||
bound_to_peer = 1;
|
||||
|
||||
if (hio_svc_htts_task_handleexpect100(prxy, 0) <= -1) goto oops;
|
||||
if (hio_svc_htts_task_handleexpect100((hio_svc_htts_task_t*)prxy, 0) <= -1) goto oops;
|
||||
if (setup_for_content_length(prxy, req) <= -1) goto oops;
|
||||
|
||||
/* TODO: store current input watching state and use it when destroying the prxy data */
|
||||
@ -970,7 +970,7 @@ oops:
|
||||
HIO_DEBUG2 (hio, "HTTS(%p) - FAILURE in doprxy - socket(%p)\n", htts, csck);
|
||||
if (prxy)
|
||||
{
|
||||
hio_svc_htts_task_sendfinalres(prxy, status_code, HIO_NULL, HIO_NULL, 1);
|
||||
hio_svc_htts_task_sendfinalres((hio_svc_htts_task_t*)prxy, status_code, HIO_NULL, HIO_NULL, 1);
|
||||
if (bound_to_peer) unbind_task_from_peer (prxy, 1);
|
||||
if (bound_to_client) unbind_task_from_client (prxy, 1);
|
||||
prxy_halt_participating_devices (prxy);
|
||||
|
@ -219,7 +219,7 @@ static void thr_peer_on_close (hio_dev_thr_t* peer, hio_dev_thr_sid_t sid)
|
||||
|
||||
if (!(thr->over & THR_OVER_READ_FROM_PEER))
|
||||
{
|
||||
if (hio_svc_htts_task_endbody(thr) <= -1)
|
||||
if (hio_svc_htts_task_endbody((hio_svc_htts_task_t*)thr) <= -1)
|
||||
thr_halt_participating_devices (thr);
|
||||
else
|
||||
thr_mark_over (thr, THR_OVER_READ_FROM_PEER);
|
||||
@ -261,7 +261,7 @@ static int thr_peer_on_read (hio_dev_thr_t* peer, const void* data, hio_iolen_t
|
||||
/* the thr script could be misbehaviing.
|
||||
* it still has to read more but EOF is read.
|
||||
* otherwise client_peer_htrd_poke() should have been called */
|
||||
n = hio_svc_htts_task_endbody(thr);
|
||||
n = hio_svc_htts_task_endbody((hio_svc_htts_task_t*)thr);
|
||||
thr_mark_over (thr, THR_OVER_READ_FROM_PEER);
|
||||
if (n <= -1) goto oops;
|
||||
}
|
||||
@ -278,7 +278,7 @@ static int thr_peer_on_read (hio_dev_thr_t* peer, const void* data, hio_iolen_t
|
||||
|
||||
if (!thr->task_res_started && !(thr->over & THR_OVER_WRITE_TO_CLIENT))
|
||||
{
|
||||
hio_svc_htts_task_sendfinalres (thr, HIO_HTTP_STATUS_BAD_GATEWAY, HIO_NULL, HIO_NULL, 1); /* don't care about error because it jumps to oops below anyway */
|
||||
hio_svc_htts_task_sendfinalres ((hio_svc_htts_task_t*)thr, HIO_HTTP_STATUS_BAD_GATEWAY, HIO_NULL, HIO_NULL, 1); /* don't care about error because it jumps to oops below anyway */
|
||||
}
|
||||
|
||||
goto oops;
|
||||
@ -302,7 +302,7 @@ oops:
|
||||
static int peer_capture_response_header (hio_htre_t* req, const hio_bch_t* key, const hio_htre_hdrval_t* val, void* ctx)
|
||||
{
|
||||
thr_t* thr = (thr_t*)ctx;
|
||||
return hio_svc_htts_task_addreshdrs(thr, key, val);
|
||||
return hio_svc_htts_task_addreshdrs((hio_svc_htts_task_t*)thr, key, val);
|
||||
}
|
||||
|
||||
static int thr_peer_htrd_peek (hio_htrd_t* htrd, hio_htre_t* req)
|
||||
@ -321,9 +321,9 @@ static int thr_peer_htrd_peek (hio_htrd_t* htrd, hio_htre_t* req)
|
||||
|
||||
chunked = thr->task_keep_client_alive && !req->attr.content_length;
|
||||
|
||||
if (hio_svc_htts_task_startreshdr(thr, status_code, status_desc, chunked) <= -1 ||
|
||||
if (hio_svc_htts_task_startreshdr((hio_svc_htts_task_t*)thr, status_code, status_desc, chunked) <= -1 ||
|
||||
hio_htre_walkheaders(req, peer_capture_response_header, thr) <= -1 ||
|
||||
hio_svc_htts_task_endreshdr(thr) <= -1) return -1;
|
||||
hio_svc_htts_task_endreshdr((hio_svc_htts_task_t*)thr) <= -1) return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -336,7 +336,7 @@ static int thr_peer_htrd_poke (hio_htrd_t* htrd, hio_htre_t* req)
|
||||
thr_t* thr = pxtn->task;
|
||||
int n;
|
||||
|
||||
n = hio_svc_htts_task_endbody(thr);
|
||||
n = hio_svc_htts_task_endbody((hio_svc_htts_task_t*)thr);
|
||||
thr_mark_over (thr, THR_OVER_READ_FROM_PEER);
|
||||
return n;
|
||||
}
|
||||
@ -349,7 +349,7 @@ static int thr_peer_htrd_push_content (hio_htrd_t* htrd, hio_htre_t* req, const
|
||||
|
||||
HIO_ASSERT (thr->htts->hio, htrd == thr->peer_htrd);
|
||||
|
||||
n = hio_svc_htts_task_addresbody(thr, data, dlen);
|
||||
n = hio_svc_htts_task_addresbody((hio_svc_htts_task_t*)thr, data, dlen);
|
||||
if (thr->task_res_pending_writes > THR_PENDING_IO_THRESHOLD)
|
||||
{
|
||||
if (hio_dev_thr_read(thr->peer, 0) <= -1) n = -1;
|
||||
@ -461,7 +461,7 @@ static void thr_client_on_disconnect (hio_dev_sck_t* sck)
|
||||
|
||||
if (thr)
|
||||
{
|
||||
HIO_SVC_HTTS_TASK_RCUP (thr);
|
||||
HIO_SVC_HTTS_TASK_RCUP ((hio_svc_htts_task_t*)thr);
|
||||
|
||||
unbind_task_from_client (thr, 1);
|
||||
|
||||
@ -469,7 +469,7 @@ static void thr_client_on_disconnect (hio_dev_sck_t* sck)
|
||||
/*if (thr->client_org_on_disconnect) thr->client_org_on_disconnect (sck);*/
|
||||
if (sck->on_disconnect) sck->on_disconnect (sck); /* restored to the orginal parent handler in unbind_task_from_client() */
|
||||
|
||||
HIO_SVC_HTTS_TASK_RCDOWN (thr);
|
||||
HIO_SVC_HTTS_TASK_RCDOWN ((hio_svc_htts_task_t*)thr);
|
||||
}
|
||||
|
||||
HIO_DEBUG4 (hio, "HTTS(%p) - thr(t=%p,c=%p,csck=%p) - client socket disconnect handled\n", htts, thr, cli, sck);
|
||||
@ -869,7 +869,7 @@ int hio_svc_htts_dothr (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* r
|
||||
if (bind_task_to_peer(thr, csck, req, func, ctx) <= -1) goto oops;
|
||||
bound_to_peer = 1;
|
||||
|
||||
if (hio_svc_htts_task_handleexpect100(thr, 0) <= -1) goto oops;
|
||||
if (hio_svc_htts_task_handleexpect100((hio_svc_htts_task_t*)thr, 0) <= -1) goto oops;
|
||||
if (setup_for_content_length(thr, req) <= -1) goto oops;
|
||||
|
||||
/* TODO: store current input watching state and use it when destroying the thr data */
|
||||
@ -887,7 +887,7 @@ oops:
|
||||
HIO_DEBUG2 (hio, "HTTS(%p) - FAILURE in dothr - socket(%p)\n", htts, csck);
|
||||
if (thr)
|
||||
{
|
||||
hio_svc_htts_task_sendfinalres(thr, status_code, HIO_NULL, HIO_NULL, 1);
|
||||
hio_svc_htts_task_sendfinalres((hio_svc_htts_task_t*)thr, status_code, HIO_NULL, HIO_NULL, 1);
|
||||
if (bound_to_peer) unbind_task_from_peer (thr, 1);
|
||||
if (bound_to_client) unbind_task_from_client (thr, 1);
|
||||
thr_halt_participating_devices (thr);
|
||||
|
@ -358,13 +358,13 @@ int hio_svc_htts_dotxt (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* r
|
||||
bind_task_to_client (txt, csck);
|
||||
bound_to_client = 1;
|
||||
|
||||
if (hio_svc_htts_task_handleexpect100(txt, 1) <= -1) goto oops;
|
||||
if (hio_svc_htts_task_handleexpect100((hio_svc_htts_task_t*)txt, 1) <= -1) goto oops;
|
||||
if (setup_for_content_length(txt, req) <= -1) goto oops;
|
||||
|
||||
/* TODO: store current input watching state and use it when destroying the txt data */
|
||||
if (hio_dev_sck_read(csck, !(txt->over & TXT_OVER_READ_FROM_CLIENT)) <= -1) goto oops;
|
||||
|
||||
if (hio_svc_htts_task_sendfinalres(txt, res_status_code, content_type, content_text, 0) <= -1) goto oops;
|
||||
if (hio_svc_htts_task_sendfinalres((hio_svc_htts_task_t*)txt, res_status_code, content_type, content_text, 0) <= -1) goto oops;
|
||||
|
||||
HIO_SVC_HTTS_TASKL_APPEND_TASK (&htts->task, (hio_svc_htts_task_t*)txt);
|
||||
HIO_SVC_HTTS_TASK_RCDOWN ((hio_svc_htts_task_t*)txt);
|
||||
@ -378,7 +378,7 @@ oops:
|
||||
HIO_DEBUG2 (hio, "HTTS(%p) - FAILURE in dotxt - socket(%p)\n", htts, csck);
|
||||
if (txt)
|
||||
{
|
||||
hio_svc_htts_task_sendfinalres(txt, status_code, HIO_NULL, HIO_NULL, 1);
|
||||
hio_svc_htts_task_sendfinalres((hio_svc_htts_task_t*)txt, status_code, HIO_NULL, HIO_NULL, 1);
|
||||
if (bound_to_client) unbind_task_from_client (txt, 1);
|
||||
txt_halt_participating_devices (txt);
|
||||
HIO_SVC_HTTS_TASK_RCDOWN ((hio_svc_htts_task_t*)txt);
|
||||
|
@ -311,7 +311,7 @@ static int dev_pipe_writev_slave (hio_dev_t* dev, const hio_iovec_t* iov, hio_io
|
||||
return 1; /* indicate that the operation got successful. the core will execute on_write() with 0. */
|
||||
}
|
||||
|
||||
x = writev(pipe->pfd, iov, *iovcnt);
|
||||
x = writev(pipe->pfd, (struct iovec*)iov, *iovcnt);
|
||||
if (x <= -1)
|
||||
{
|
||||
if (errno == EINPROGRESS || errno == EWOULDBLOCK || errno == EAGAIN) return 0; /* no data can be written */
|
||||
|
@ -668,7 +668,7 @@ static int dev_pro_writev_slave (hio_dev_t* dev, const hio_iovec_t* iov, hio_iol
|
||||
return 1; /* indicate that the operation got successful. the core will execute on_write() with 0. */
|
||||
}
|
||||
|
||||
x = writev(pro->pfd, iov, *iovcnt);
|
||||
x = writev(pro->pfd, (struct iovec*)iov, *iovcnt);
|
||||
if (x <= -1)
|
||||
{
|
||||
if (errno == EINPROGRESS || errno == EWOULDBLOCK || errno == EAGAIN) return 0; /* no data can be written */
|
||||
|
@ -439,7 +439,7 @@ static int dev_pty_writev (hio_dev_t* dev, const hio_iovec_t* iov, hio_iolen_t*
|
||||
return 1; /* indicate that the operation got successful. the core will execute on_write() with 0. */
|
||||
}
|
||||
|
||||
x = writev(pty->hnd, iov, *iovcnt);
|
||||
x = writev(pty->hnd, (struct iovec*)iov, *iovcnt);
|
||||
if (x <= -1)
|
||||
{
|
||||
if (errno == EINPROGRESS || errno == EWOULDBLOCK || errno == EAGAIN) return 0; /* no data can be written */
|
||||
|
@ -164,7 +164,7 @@ static int dev_shw_writev (hio_dev_t* dev, const hio_iovec_t* iov, hio_iolen_t*
|
||||
return 1; /* indicate that the operation got successful. the core will execute on_write() with 0. */
|
||||
}
|
||||
|
||||
x = writev(shw->hnd, iov, *iovcnt);
|
||||
x = writev(shw->hnd, (struct iovec*)iov, *iovcnt);
|
||||
if (x <= -1)
|
||||
{
|
||||
if (errno == EINPROGRESS || errno == EWOULDBLOCK || errno == EAGAIN) return 0; /* no data can be written */
|
||||
|
@ -484,7 +484,7 @@ static int dev_thr_writev_slave (hio_dev_t* dev, const hio_iovec_t* iov, hio_iol
|
||||
return 1; /* indicate that the operation got successful. the core will execute on_write() with 0. */
|
||||
}
|
||||
|
||||
x = writev(thr->pfd, iov, *iovcnt);
|
||||
x = writev(thr->pfd, (struct iovec*)iov, *iovcnt);
|
||||
if (x <= -1)
|
||||
{
|
||||
if (errno == EINPROGRESS || errno == EWOULDBLOCK || errno == EAGAIN) return 0; /* no data can be written */
|
||||
|
Loading…
x
Reference in New Issue
Block a user