added cgi test code

This commit is contained in:
hyung-hwan 2023-01-15 02:17:12 +09:00
parent a7dde21b4d
commit 9c35acfc63
7 changed files with 220 additions and 89 deletions

View File

@ -34,53 +34,6 @@ hio_te_LDFLAGS = $(LDFLAGS_COMMON)
hio_te_LDADD = $(LIBADD_COMMON) -lX11 hio_te_LDADD = $(LIBADD_COMMON) -lX11
endif endif
bin_PROGRAMS += hio-t01
hio_t01_SOURCES = t01.c
hio_t01_CPPFLAGS = $(CPPFLAGS_COMMON)
hio_t01_CFLAGS = $(CFLAGS_COMMON)
hio_t01_LDFLAGS = $(LDFLAGS_COMMON)
hio_t01_LDADD = $(LIBADD_COMMON)
bin_PROGRAMS += hio-t02
hio_t02_SOURCES = t02.c
hio_t02_CPPFLAGS = $(CPPFLAGS_COMMON)
hio_t02_CFLAGS = $(CFLAGS_COMMON)
hio_t02_LDFLAGS = $(LDFLAGS_COMMON)
hio_t02_LDADD = $(LIBADD_COMMON)
bin_PROGRAMS += hio-t03
hio_t03_SOURCES = t03.c
hio_t03_CPPFLAGS = $(CPPFLAGS_COMMON)
hio_t03_CFLAGS = $(CFLAGS_COMMON)
hio_t03_LDFLAGS = $(LDFLAGS_COMMON)
hio_t03_LDADD = $(LIBADD_COMMON)
bin_PROGRAMS += hio-t04
hio_t04_SOURCES = t04.c
hio_t04_CPPFLAGS = $(CPPFLAGS_COMMON)
hio_t04_CFLAGS = $(CFLAGS_COMMON)
hio_t04_LDFLAGS = $(LDFLAGS_COMMON)
hio_t04_LDADD = $(LIBADD_COMMON)
if ENABLE_MARIADB
hio_t04_CFLAGS += $(MARIADB_CFLAGS)
hio_t04_LDFLAGS += $(MARIADB_LDFLAGS)
hio_t04_LDADD += $(MARIADB_LIBS)
endif
bin_PROGRAMS += hio-t05
hio_t05_SOURCES = t05.c
hio_t05_CPPFLAGS = $(CPPFLAGS_COMMON)
hio_t05_CFLAGS = $(CFLAGS_COMMON)
hio_t05_LDFLAGS = $(LDFLAGS_COMMON)
hio_t05_LDADD = $(LIBADD_COMMON)
bin_PROGRAMS += hio-t06
hio_t06_SOURCES = t06.c
hio_t06_CPPFLAGS = $(CPPFLAGS_COMMON)
hio_t06_CFLAGS = $(CFLAGS_COMMON)
hio_t06_LDFLAGS = $(LDFLAGS_COMMON)
hio_t06_LDADD = $(LIBADD_COMMON)
bin_PROGRAMS += hio-untar bin_PROGRAMS += hio-untar
hio_untar_SOURCES = untar.c hio_untar_SOURCES = untar.c
hio_untar_CPPFLAGS = $(CPPFLAGS_COMMON) hio_untar_CPPFLAGS = $(CPPFLAGS_COMMON)
@ -94,3 +47,53 @@ hio_webs_CPPFLAGS = $(CPPFLAGS_COMMON)
hio_webs_CFLAGS = $(CFLAGS_COMMON) hio_webs_CFLAGS = $(CFLAGS_COMMON)
hio_webs_LDFLAGS = $(LDFLAGS_COMMON) $(LDFLAGS_ALL_STATIC) hio_webs_LDFLAGS = $(LDFLAGS_COMMON) $(LDFLAGS_ALL_STATIC)
hio_webs_LDADD = $(LIBADD_COMMON) $(LIBADD_ALL_STATIC) hio_webs_LDADD = $(LIBADD_COMMON) $(LIBADD_ALL_STATIC)
# -------------------------------------------------
noinst_PROGRAMS = hio-t01
hio_t01_SOURCES = t01.c
hio_t01_CPPFLAGS = $(CPPFLAGS_COMMON)
hio_t01_CFLAGS = $(CFLAGS_COMMON)
hio_t01_LDFLAGS = $(LDFLAGS_COMMON)
hio_t01_LDADD = $(LIBADD_COMMON)
noinst_PROGRAMS += hio-t02
hio_t02_SOURCES = t02.c
hio_t02_CPPFLAGS = $(CPPFLAGS_COMMON)
hio_t02_CFLAGS = $(CFLAGS_COMMON)
hio_t02_LDFLAGS = $(LDFLAGS_COMMON)
hio_t02_LDADD = $(LIBADD_COMMON)
noinst_PROGRAMS += hio-t03
hio_t03_SOURCES = t03.c
hio_t03_CPPFLAGS = $(CPPFLAGS_COMMON)
hio_t03_CFLAGS = $(CFLAGS_COMMON)
hio_t03_LDFLAGS = $(LDFLAGS_COMMON)
hio_t03_LDADD = $(LIBADD_COMMON)
noinst_PROGRAMS += hio-t04
hio_t04_SOURCES = t04.c
hio_t04_CPPFLAGS = $(CPPFLAGS_COMMON)
hio_t04_CFLAGS = $(CFLAGS_COMMON)
hio_t04_LDFLAGS = $(LDFLAGS_COMMON)
hio_t04_LDADD = $(LIBADD_COMMON)
if ENABLE_MARIADB
hio_t04_CFLAGS += $(MARIADB_CFLAGS)
hio_t04_LDFLAGS += $(MARIADB_LDFLAGS)
hio_t04_LDADD += $(MARIADB_LIBS)
endif
noinst_PROGRAMS += hio-t05
hio_t05_SOURCES = t05.c
hio_t05_CPPFLAGS = $(CPPFLAGS_COMMON)
hio_t05_CFLAGS = $(CFLAGS_COMMON)
hio_t05_LDFLAGS = $(LDFLAGS_COMMON)
hio_t05_LDADD = $(LIBADD_COMMON)
noinst_PROGRAMS += hio-t06
hio_t06_SOURCES = t06.c
hio_t06_CPPFLAGS = $(CPPFLAGS_COMMON)
hio_t06_CFLAGS = $(CFLAGS_COMMON)
hio_t06_LDFLAGS = $(LDFLAGS_COMMON)
hio_t06_LDADD = $(LIBADD_COMMON)

View File

@ -88,11 +88,11 @@ PRE_UNINSTALL = :
POST_UNINSTALL = : POST_UNINSTALL = :
build_triplet = @build@ build_triplet = @build@
host_triplet = @host@ host_triplet = @host@
bin_PROGRAMS = hio-execd$(EXEEXT) $(am__EXEEXT_1) hio-t01$(EXEEXT) \ bin_PROGRAMS = hio-execd$(EXEEXT) $(am__EXEEXT_1) hio-untar$(EXEEXT) \
hio-t02$(EXEEXT) hio-t03$(EXEEXT) hio-t04$(EXEEXT) \
hio-t05$(EXEEXT) hio-t06$(EXEEXT) hio-untar$(EXEEXT) \
hio-webs$(EXEEXT) hio-webs$(EXEEXT)
@HAVE_X11_LIB_TRUE@am__append_1 = hio-te @HAVE_X11_LIB_TRUE@am__append_1 = hio-te
noinst_PROGRAMS = hio-t01$(EXEEXT) hio-t02$(EXEEXT) hio-t03$(EXEEXT) \
hio-t04$(EXEEXT) hio-t05$(EXEEXT) hio-t06$(EXEEXT)
@ENABLE_MARIADB_TRUE@am__append_2 = $(MARIADB_CFLAGS) @ENABLE_MARIADB_TRUE@am__append_2 = $(MARIADB_CFLAGS)
@ENABLE_MARIADB_TRUE@am__append_3 = $(MARIADB_LDFLAGS) @ENABLE_MARIADB_TRUE@am__append_3 = $(MARIADB_LDFLAGS)
@ENABLE_MARIADB_TRUE@am__append_4 = $(MARIADB_LIBS) @ENABLE_MARIADB_TRUE@am__append_4 = $(MARIADB_LIBS)
@ -113,7 +113,7 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES = CONFIG_CLEAN_VPATH_FILES =
@HAVE_X11_LIB_TRUE@am__EXEEXT_1 = hio-te$(EXEEXT) @HAVE_X11_LIB_TRUE@am__EXEEXT_1 = hio-te$(EXEEXT)
am__installdirs = "$(DESTDIR)$(bindir)" am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS) PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
am_hio_execd_OBJECTS = hio_execd-execd.$(OBJEXT) am_hio_execd_OBJECTS = hio_execd-execd.$(OBJEXT)
hio_execd_OBJECTS = $(am_hio_execd_OBJECTS) hio_execd_OBJECTS = $(am_hio_execd_OBJECTS)
hio_execd_DEPENDENCIES = $(LIBADD_COMMON) hio_execd_DEPENDENCIES = $(LIBADD_COMMON)
@ -418,6 +418,16 @@ hio_execd_LDADD = $(LIBADD_COMMON)
@HAVE_X11_LIB_TRUE@hio_te_CFLAGS = $(CFLAGS_COMMON) @HAVE_X11_LIB_TRUE@hio_te_CFLAGS = $(CFLAGS_COMMON)
@HAVE_X11_LIB_TRUE@hio_te_LDFLAGS = $(LDFLAGS_COMMON) @HAVE_X11_LIB_TRUE@hio_te_LDFLAGS = $(LDFLAGS_COMMON)
@HAVE_X11_LIB_TRUE@hio_te_LDADD = $(LIBADD_COMMON) -lX11 @HAVE_X11_LIB_TRUE@hio_te_LDADD = $(LIBADD_COMMON) -lX11
hio_untar_SOURCES = untar.c
hio_untar_CPPFLAGS = $(CPPFLAGS_COMMON)
hio_untar_CFLAGS = $(CFLAGS_COMMON)
hio_untar_LDFLAGS = $(LDFLAGS_COMMON)
hio_untar_LDADD = $(LIBADD_COMMON)
hio_webs_SOURCES = webs.c
hio_webs_CPPFLAGS = $(CPPFLAGS_COMMON)
hio_webs_CFLAGS = $(CFLAGS_COMMON)
hio_webs_LDFLAGS = $(LDFLAGS_COMMON) $(LDFLAGS_ALL_STATIC)
hio_webs_LDADD = $(LIBADD_COMMON) $(LIBADD_ALL_STATIC)
hio_t01_SOURCES = t01.c hio_t01_SOURCES = t01.c
hio_t01_CPPFLAGS = $(CPPFLAGS_COMMON) hio_t01_CPPFLAGS = $(CPPFLAGS_COMMON)
hio_t01_CFLAGS = $(CFLAGS_COMMON) hio_t01_CFLAGS = $(CFLAGS_COMMON)
@ -448,16 +458,6 @@ hio_t06_CPPFLAGS = $(CPPFLAGS_COMMON)
hio_t06_CFLAGS = $(CFLAGS_COMMON) hio_t06_CFLAGS = $(CFLAGS_COMMON)
hio_t06_LDFLAGS = $(LDFLAGS_COMMON) hio_t06_LDFLAGS = $(LDFLAGS_COMMON)
hio_t06_LDADD = $(LIBADD_COMMON) hio_t06_LDADD = $(LIBADD_COMMON)
hio_untar_SOURCES = untar.c
hio_untar_CPPFLAGS = $(CPPFLAGS_COMMON)
hio_untar_CFLAGS = $(CFLAGS_COMMON)
hio_untar_LDFLAGS = $(LDFLAGS_COMMON)
hio_untar_LDADD = $(LIBADD_COMMON)
hio_webs_SOURCES = webs.c
hio_webs_CPPFLAGS = $(CPPFLAGS_COMMON)
hio_webs_CFLAGS = $(CFLAGS_COMMON)
hio_webs_LDFLAGS = $(LDFLAGS_COMMON) $(LDFLAGS_ALL_STATIC)
hio_webs_LDADD = $(LIBADD_COMMON) $(LIBADD_ALL_STATIC)
all: all-am all: all-am
.SUFFIXES: .SUFFIXES:
@ -541,6 +541,15 @@ clean-binPROGRAMS:
echo " rm -f" $$list; \ echo " rm -f" $$list; \
rm -f $$list rm -f $$list
clean-noinstPROGRAMS:
@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
hio-execd$(EXEEXT): $(hio_execd_OBJECTS) $(hio_execd_DEPENDENCIES) $(EXTRA_hio_execd_DEPENDENCIES) hio-execd$(EXEEXT): $(hio_execd_OBJECTS) $(hio_execd_DEPENDENCIES) $(EXTRA_hio_execd_DEPENDENCIES)
@rm -f hio-execd$(EXEEXT) @rm -f hio-execd$(EXEEXT)
$(AM_V_CCLD)$(hio_execd_LINK) $(hio_execd_OBJECTS) $(hio_execd_LDADD) $(LIBS) $(AM_V_CCLD)$(hio_execd_LINK) $(hio_execd_OBJECTS) $(hio_execd_LDADD) $(LIBS)
@ -898,7 +907,8 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild." @echo "it deletes files that may require special tools to rebuild."
clean: clean-am clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool \
clean-noinstPROGRAMS mostlyclean-am
distclean: distclean-am distclean: distclean-am
-rm -f ./$(DEPDIR)/hio_execd-execd.Po -rm -f ./$(DEPDIR)/hio_execd-execd.Po
@ -987,15 +997,16 @@ uninstall-am: uninstall-binPROGRAMS
.MAKE: install-am install-strip .MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \ clean-binPROGRAMS clean-generic clean-libtool \
ctags ctags-am distclean distclean-compile distclean-generic \ clean-noinstPROGRAMS cscopelist-am ctags ctags-am distclean \
distclean-libtool distclean-tags distdir dvi dvi-am html \ distclean-compile distclean-generic distclean-libtool \
html-am info info-am install install-am install-binPROGRAMS \ distclean-tags distdir dvi dvi-am html html-am info info-am \
install-data install-data-am install-dvi install-dvi-am \ install install-am install-binPROGRAMS install-data \
install-exec install-exec-am install-html install-html-am \ install-data-am install-dvi install-dvi-am install-exec \
install-info install-info-am install-man install-pdf \ install-exec-am install-html install-html-am install-info \
install-pdf-am install-ps install-ps-am install-strip \ install-info-am install-man install-pdf install-pdf-am \
installcheck installcheck-am installdirs maintainer-clean \ install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \ maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-am uninstall uninstall-am uninstall-binPROGRAMS tags tags-am uninstall uninstall-am uninstall-binPROGRAMS

View File

@ -869,6 +869,9 @@ static int cgi_peer_on_fork (hio_dev_pro_t* pro, void* fork_ctx)
hio_becs_t dbuf; hio_becs_t dbuf;
qparam = hio_htre_getqparam(fc->req); qparam = hio_htre_getqparam(fc->req);
/* the anchor/fragment is never part of the server-side URL.
* the client must discard that part before sending to the server.
* hio_htre_getqanchor() is just disregarded here. */
tmpstr = getenv("PATH"); tmpstr = getenv("PATH");
if (!tmpstr) tmpstr = ""; if (!tmpstr) tmpstr = "";
@ -917,6 +920,7 @@ static int cgi_peer_on_fork (hio_dev_pro_t* pro, void* fork_ctx)
setenv ("REQUEST_METHOD", hio_htre_getqmethodname(fc->req), 1); setenv ("REQUEST_METHOD", hio_htre_getqmethodname(fc->req), 1);
setenv ("REQUEST_URI", hio_htre_getqpath(fc->req), 1); setenv ("REQUEST_URI", hio_htre_getqpath(fc->req), 1);
if (qparam) setenv ("QUERY_STRING", qparam, 1); if (qparam) setenv ("QUERY_STRING", qparam, 1);
if (hio_htre_getreqcontentlen(fc->req, &content_length) == 0) if (hio_htre_getreqcontentlen(fc->req, &content_length) == 0)

View File

@ -8,11 +8,19 @@ CPPFLAGS_COMMON = \
-I$(includedir) -I$(includedir)
CFLAGS_COMMON = CFLAGS_COMMON =
LDFLAGS_COMMON=-L$(abs_builddir)/../lib -L$(libdir) LDFLAGS_COMMON=-L$(abs_builddir)/../lib -L$(libdir)
## place $(LIBM) here as all programs below are C only programs linked ## place $(LIBM) here as all programs below are C only programs linked
## against the C/C++ hybrid library. Read comments in ../bin/Makefile.am ## against the C/C++ hybrid library. Read comments in ../bin/Makefile.am
## for more information. ## for more information.
LIBADD_COMMON = ../lib/libhio.la $(LIBM) LIBADD_COMMON = ../lib/libhio.la $(LIBM)
noinst_PROGRAMS = t-cgi
t_cgi_source = t-cgi.c
t_cgi_CPPFLAGS = $(CPPFLAGS_COMMON)
t_cgi_CFLAGS = $(CFLAGS_COMMON)
t_cgi_LDFLAGS = $(LDFLAGS_COMMON)
t_cgi_LDADD = $(LIBADD_COMMON)
check_SCRIPTS = s-001.sh check_SCRIPTS = s-001.sh
EXTRA_DIST = $(check_SCRIPTS) EXTRA_DIST = $(check_SCRIPTS)

View File

@ -13,6 +13,7 @@
# PARTICULAR PURPOSE. # PARTICULAR PURPOSE.
@SET_MAKE@ @SET_MAKE@
VPATH = @srcdir@ VPATH = @srcdir@
am__is_gnu_make = { \ am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \ if test -z '$(MAKELEVEL)'; then \
@ -87,6 +88,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = : POST_UNINSTALL = :
build_triplet = @build@ build_triplet = @build@
host_triplet = @host@ host_triplet = @host@
noinst_PROGRAMS = t-cgi$(EXEEXT)
check_PROGRAMS = t-001$(EXEEXT) t-002$(EXEEXT) t-003$(EXEEXT) \ check_PROGRAMS = t-001$(EXEEXT) t-002$(EXEEXT) t-003$(EXEEXT) \
t-004$(EXEEXT) t-005$(EXEEXT) t-004$(EXEEXT) t-005$(EXEEXT)
subdir = t subdir = t
@ -104,6 +106,7 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/lib/hio-cfg.h CONFIG_HEADER = $(top_builddir)/lib/hio-cfg.h
CONFIG_CLEAN_FILES = CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES = CONFIG_CLEAN_VPATH_FILES =
PROGRAMS = $(noinst_PROGRAMS)
am_t_001_OBJECTS = t_001-t-001.$(OBJEXT) am_t_001_OBJECTS = t_001-t-001.$(OBJEXT)
t_001_OBJECTS = $(am_t_001_OBJECTS) t_001_OBJECTS = $(am_t_001_OBJECTS)
am__DEPENDENCIES_1 = am__DEPENDENCIES_1 =
@ -140,6 +143,12 @@ t_005_DEPENDENCIES = $(am__DEPENDENCIES_2)
t_005_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ t_005_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(t_005_CFLAGS) $(CFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(t_005_CFLAGS) $(CFLAGS) \
$(t_005_LDFLAGS) $(LDFLAGS) -o $@ $(t_005_LDFLAGS) $(LDFLAGS) -o $@
t_cgi_SOURCES = t-cgi.c
t_cgi_OBJECTS = t_cgi-t-cgi.$(OBJEXT)
t_cgi_DEPENDENCIES = $(am__DEPENDENCIES_2)
t_cgi_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(t_cgi_CFLAGS) $(CFLAGS) \
$(t_cgi_LDFLAGS) $(LDFLAGS) -o $@
AM_V_P = $(am__v_P_@AM_V@) AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false am__v_P_0 = false
@ -157,7 +166,8 @@ depcomp = $(SHELL) $(top_srcdir)/ac/depcomp
am__maybe_remake_depfiles = depfiles am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/t_001-t-001.Po \ am__depfiles_remade = ./$(DEPDIR)/t_001-t-001.Po \
./$(DEPDIR)/t_002-t-002.Po ./$(DEPDIR)/t_003-t-003.Po \ ./$(DEPDIR)/t_002-t-002.Po ./$(DEPDIR)/t_003-t-003.Po \
./$(DEPDIR)/t_004-t-004.Po ./$(DEPDIR)/t_005-t-005.Po ./$(DEPDIR)/t_004-t-004.Po ./$(DEPDIR)/t_005-t-005.Po \
./$(DEPDIR)/t_cgi-t-cgi.Po
am__mv = mv -f am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@ -178,9 +188,9 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 = am__v_CCLD_1 =
SOURCES = $(t_001_SOURCES) $(t_002_SOURCES) $(t_003_SOURCES) \ SOURCES = $(t_001_SOURCES) $(t_002_SOURCES) $(t_003_SOURCES) \
$(t_004_SOURCES) $(t_005_SOURCES) $(t_004_SOURCES) $(t_005_SOURCES) t-cgi.c
DIST_SOURCES = $(t_001_SOURCES) $(t_002_SOURCES) $(t_003_SOURCES) \ DIST_SOURCES = $(t_001_SOURCES) $(t_002_SOURCES) $(t_003_SOURCES) \
$(t_004_SOURCES) $(t_005_SOURCES) $(t_004_SOURCES) $(t_005_SOURCES) t-cgi.c
am__can_run_installinfo = \ am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \ case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \ n|no|NO) false;; \
@ -557,6 +567,11 @@ CPPFLAGS_COMMON = \
CFLAGS_COMMON = CFLAGS_COMMON =
LDFLAGS_COMMON = -L$(abs_builddir)/../lib -L$(libdir) LDFLAGS_COMMON = -L$(abs_builddir)/../lib -L$(libdir)
LIBADD_COMMON = ../lib/libhio.la $(LIBM) LIBADD_COMMON = ../lib/libhio.la $(LIBM)
t_cgi_source = t-cgi.c
t_cgi_CPPFLAGS = $(CPPFLAGS_COMMON)
t_cgi_CFLAGS = $(CFLAGS_COMMON)
t_cgi_LDFLAGS = $(LDFLAGS_COMMON)
t_cgi_LDADD = $(LIBADD_COMMON)
check_SCRIPTS = s-001.sh check_SCRIPTS = s-001.sh
EXTRA_DIST = $(check_SCRIPTS) EXTRA_DIST = $(check_SCRIPTS)
t_001_SOURCES = t-001.c t.h t_001_SOURCES = t-001.c t.h
@ -632,6 +647,15 @@ clean-checkPROGRAMS:
echo " rm -f" $$list; \ echo " rm -f" $$list; \
rm -f $$list rm -f $$list
clean-noinstPROGRAMS:
@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
t-001$(EXEEXT): $(t_001_OBJECTS) $(t_001_DEPENDENCIES) $(EXTRA_t_001_DEPENDENCIES) t-001$(EXEEXT): $(t_001_OBJECTS) $(t_001_DEPENDENCIES) $(EXTRA_t_001_DEPENDENCIES)
@rm -f t-001$(EXEEXT) @rm -f t-001$(EXEEXT)
$(AM_V_CCLD)$(t_001_LINK) $(t_001_OBJECTS) $(t_001_LDADD) $(LIBS) $(AM_V_CCLD)$(t_001_LINK) $(t_001_OBJECTS) $(t_001_LDADD) $(LIBS)
@ -652,6 +676,10 @@ t-005$(EXEEXT): $(t_005_OBJECTS) $(t_005_DEPENDENCIES) $(EXTRA_t_005_DEPENDENCIE
@rm -f t-005$(EXEEXT) @rm -f t-005$(EXEEXT)
$(AM_V_CCLD)$(t_005_LINK) $(t_005_OBJECTS) $(t_005_LDADD) $(LIBS) $(AM_V_CCLD)$(t_005_LINK) $(t_005_OBJECTS) $(t_005_LDADD) $(LIBS)
t-cgi$(EXEEXT): $(t_cgi_OBJECTS) $(t_cgi_DEPENDENCIES) $(EXTRA_t_cgi_DEPENDENCIES)
@rm -f t-cgi$(EXEEXT)
$(AM_V_CCLD)$(t_cgi_LINK) $(t_cgi_OBJECTS) $(t_cgi_LDADD) $(LIBS)
mostlyclean-compile: mostlyclean-compile:
-rm -f *.$(OBJEXT) -rm -f *.$(OBJEXT)
@ -663,6 +691,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_003-t-003.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_003-t-003.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_004-t-004.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_004-t-004.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_005-t-005.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_005-t-005.Po@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t_cgi-t-cgi.Po@am__quote@ # am--include-marker
$(am__depfiles_remade): $(am__depfiles_remade):
@$(MKDIR_P) $(@D) @$(MKDIR_P) $(@D)
@ -764,6 +793,20 @@ t_005-t-005.obj: t-005.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(t_005_CPPFLAGS) $(CPPFLAGS) $(t_005_CFLAGS) $(CFLAGS) -c -o t_005-t-005.obj `if test -f 't-005.c'; then $(CYGPATH_W) 't-005.c'; else $(CYGPATH_W) '$(srcdir)/t-005.c'; fi` @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(t_005_CPPFLAGS) $(CPPFLAGS) $(t_005_CFLAGS) $(CFLAGS) -c -o t_005-t-005.obj `if test -f 't-005.c'; then $(CYGPATH_W) 't-005.c'; else $(CYGPATH_W) '$(srcdir)/t-005.c'; fi`
t_cgi-t-cgi.o: t-cgi.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(t_cgi_CPPFLAGS) $(CPPFLAGS) $(t_cgi_CFLAGS) $(CFLAGS) -MT t_cgi-t-cgi.o -MD -MP -MF $(DEPDIR)/t_cgi-t-cgi.Tpo -c -o t_cgi-t-cgi.o `test -f 't-cgi.c' || echo '$(srcdir)/'`t-cgi.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/t_cgi-t-cgi.Tpo $(DEPDIR)/t_cgi-t-cgi.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='t-cgi.c' object='t_cgi-t-cgi.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(t_cgi_CPPFLAGS) $(CPPFLAGS) $(t_cgi_CFLAGS) $(CFLAGS) -c -o t_cgi-t-cgi.o `test -f 't-cgi.c' || echo '$(srcdir)/'`t-cgi.c
t_cgi-t-cgi.obj: t-cgi.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(t_cgi_CPPFLAGS) $(CPPFLAGS) $(t_cgi_CFLAGS) $(CFLAGS) -MT t_cgi-t-cgi.obj -MD -MP -MF $(DEPDIR)/t_cgi-t-cgi.Tpo -c -o t_cgi-t-cgi.obj `if test -f 't-cgi.c'; then $(CYGPATH_W) 't-cgi.c'; else $(CYGPATH_W) '$(srcdir)/t-cgi.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/t_cgi-t-cgi.Tpo $(DEPDIR)/t_cgi-t-cgi.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='t-cgi.c' object='t_cgi-t-cgi.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(t_cgi_CPPFLAGS) $(CPPFLAGS) $(t_cgi_CFLAGS) $(CFLAGS) -c -o t_cgi-t-cgi.obj `if test -f 't-cgi.c'; then $(CYGPATH_W) 't-cgi.c'; else $(CYGPATH_W) '$(srcdir)/t-cgi.c'; fi`
mostlyclean-libtool: mostlyclean-libtool:
-rm -f *.lo -rm -f *.lo
@ -1050,7 +1093,7 @@ check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS) $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS)
$(MAKE) $(AM_MAKEFLAGS) check-TESTS $(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am check: check-am
all-am: Makefile all-am: Makefile $(PROGRAMS)
installdirs: installdirs:
install: install-am install: install-am
install-exec: install-exec-am install-exec: install-exec-am
@ -1088,7 +1131,7 @@ maintainer-clean-generic:
clean: clean-am clean: clean-am
clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
mostlyclean-am clean-noinstPROGRAMS mostlyclean-am
distclean: distclean-am distclean: distclean-am
-rm -f ./$(DEPDIR)/t_001-t-001.Po -rm -f ./$(DEPDIR)/t_001-t-001.Po
@ -1096,6 +1139,7 @@ distclean: distclean-am
-rm -f ./$(DEPDIR)/t_003-t-003.Po -rm -f ./$(DEPDIR)/t_003-t-003.Po
-rm -f ./$(DEPDIR)/t_004-t-004.Po -rm -f ./$(DEPDIR)/t_004-t-004.Po
-rm -f ./$(DEPDIR)/t_005-t-005.Po -rm -f ./$(DEPDIR)/t_005-t-005.Po
-rm -f ./$(DEPDIR)/t_cgi-t-cgi.Po
-rm -f Makefile -rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \ distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags distclean-tags
@ -1146,6 +1190,7 @@ maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/t_003-t-003.Po -rm -f ./$(DEPDIR)/t_003-t-003.Po
-rm -f ./$(DEPDIR)/t_004-t-004.Po -rm -f ./$(DEPDIR)/t_004-t-004.Po
-rm -f ./$(DEPDIR)/t_005-t-005.Po -rm -f ./$(DEPDIR)/t_005-t-005.Po
-rm -f ./$(DEPDIR)/t_cgi-t-cgi.Po
-rm -f Makefile -rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic maintainer-clean-am: distclean-am maintainer-clean-generic
@ -1168,17 +1213,18 @@ uninstall-am:
.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \
check-am clean clean-checkPROGRAMS clean-generic clean-libtool \ check-am clean clean-checkPROGRAMS clean-generic clean-libtool \
cscopelist-am ctags ctags-am distclean distclean-compile \ clean-noinstPROGRAMS cscopelist-am ctags ctags-am distclean \
distclean-generic distclean-libtool distclean-tags distdir dvi \ distclean-compile distclean-generic distclean-libtool \
dvi-am html html-am info info-am install install-am \ distclean-tags distdir dvi dvi-am html html-am info info-am \
install-data install-data-am install-dvi install-dvi-am \ install install-am install-data install-data-am install-dvi \
install-exec install-exec-am install-html install-html-am \ install-dvi-am install-exec install-exec-am install-html \
install-info install-info-am install-man install-pdf \ install-html-am install-info install-info-am install-man \
install-pdf-am install-ps install-ps-am install-strip \ install-pdf install-pdf-am install-ps install-ps-am \
installcheck installcheck-am installdirs maintainer-clean \ install-strip installcheck installcheck-am installdirs \
maintainer-clean-generic mostlyclean mostlyclean-compile \ maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
recheck tags tags-am uninstall uninstall-am pdf pdf-am ps ps-am recheck tags tags-am uninstall \
uninstall-am
.PRECIOUS: Makefile .PRECIOUS: Makefile

View File

@ -59,6 +59,32 @@ test_file_list_dir()
wait ${jid} wait ${jid}
} }
test_cgi()
{
local msg="hio-webs file-list-dir"
local srvaddr=127.0.0.1:54321
local tmpdir="/tmp/s-001.$$"
mkdir -p "${tmpdir}"
cp -pf t-cgi "${tmpdir}/t.cgi"
## check directory listing against an empty directory
../bin/hio-webs "${srvaddr}" "${tmpdir}" 2>/dev/null &
local jid=$!
sleep 0.5
local hc=$(curl -s -w '%{http_code}\n' -o /dev/null "http://${srvaddr}/t.cgi?abc=def#qq")
tap_ensure "$hc" "200" "$msg - got $hc"
rm -rf "${tmpdir}"
kill -TERM ${jid}
wait ${jid}
}
test_default_index test_default_index
test_file_list_dir test_file_list_dir
test_cgi
tap_end tap_end

33
t/t-cgi.c Normal file
View File

@ -0,0 +1,33 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <time.h>
int main ()
{
time_t current_time;
size_t i;
static const char* var[] =
{
"REQUEST_METHOD",
"REQUEST_URI",
"QUERY_STRING",
"REMOTE_ADDR",
"REMOTE_PORT",
"CONTENT_LENGTH"
};
printf("Content-type: text/plain\r\n\r\n");
printf("C Program Version\n");
current_time = time(NULL);
printf("It is now %s\n", ctime(&current_time));
for (i = 0; i < sizeof(var) / sizeof(var[0]); i++)
{
printf ("%s:%s\n", var[i], getenv(var[i]));
}
fflush(stdout);
exit (0);
}