added --enable-all-static and --with-all-static-libs to ease full static binary builds for selected commands

fixed a bug where the client socket is kept when keep-alive is set. it should have been closed if client EOF is detected regardless of keep-alive
touched up debug messages in http-file.c
This commit is contained in:
2022-10-08 16:47:55 +09:00
parent ba858ecbc0
commit 7ec3ba3ab7
24 changed files with 1744 additions and 1788 deletions

View File

@ -12,7 +12,7 @@ LIBADD_COMMON = ../lib/libhio.la
if ENABLE_ALL_STATIC
LDFLAGS_ALL_STATIC ?= -all-static
LIBADD_ALL_STATIC ?=
LIBADD_ALL_STATIC ?= $(ALL_STATIC_LIBS)
else
LDFLAGS_ALL_STATIC =
LIBADD_ALL_STATIC =

View File

@ -1,7 +1,7 @@
# Makefile.in generated by automake 1.16.1 from Makefile.am.
# Makefile.in generated by automake 1.16.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
# Copyright (C) 1994-2020 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@ -247,6 +247,7 @@ CTAGS = ctags
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/ac/depcomp
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
ALL_STATIC_LIBS = @ALL_STATIC_LIBS@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
@ -967,7 +968,7 @@ uninstall-am: uninstall-binPROGRAMS
@ENABLE_ALL_STATIC_TRUE@LDFLAGS_ALL_STATIC ?= -all-static
@ENABLE_ALL_STATIC_TRUE@LIBADD_ALL_STATIC ?=
@ENABLE_ALL_STATIC_TRUE@LIBADD_ALL_STATIC ?= $(ALL_STATIC_LIBS)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@ -12,6 +12,7 @@ typedef struct htts_ext_t htts_ext_t;
static int process_http_request (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* req)
{
htts_ext_t* ext = hio_svc_htts_getxtn(htts);
hio_t* hio = hio_svc_htts_gethio(htts);
hio_http_method_t mth;
const hio_bch_t* qpath;
@ -20,10 +21,15 @@ static int process_http_request (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_
mth = hio_htre_getqmethodtype(req);
qpath = hio_htre_getqpath(req);
if (mth == HIO_HTTP_GET)
if (mth == HIO_HTTP_GET || mth == HIO_HTTP_POST)
{
/* TODO: mime-type */
if (hio_svc_htts_dofile(htts, csck, req, ext->docroot, qpath, "text/plain") <= -1) goto oops;
/* TODO: proper mime-type */
const hio_bch_t* dot;
hio_bch_t mt[128];
dot = hio_rfind_bchar_in_bcstr(qpath, '.');
hio_fmttobcstr (hio, mt, HIO_COUNTOF(mt), "text/%hs", ((dot && dot[1] != '\0')? &dot[1]: "plain")); /* TODO: error check */
if (hio_svc_htts_dofile(htts, csck, req, ext->docroot, qpath, mt) <= -1) goto oops;
}
else
{