summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--.gitmodules3
-rw-r--r--GNUmakefile23
-rw-r--r--Makefile.am3
-rw-r--r--NEWS63
-rw-r--r--README15
-rwxr-xr-xbootstrap4
-rw-r--r--configure.ac10
-rw-r--r--git2clog.pl77
-rw-r--r--mimetypes/Makefile.am17
-rw-r--r--mimetypes/err.c16
-rw-r--r--mimetypes/eval.c16
-rw-r--r--mimetypes/grammar.y2
-rw-r--r--mimetypes/ident.c15
-rw-r--r--mimetypes/lexer.l4
-rw-r--r--mimetypes/linetrack.c2
-rw-r--r--mimetypes/locus.c2
-rw-r--r--mimetypes/locus.h2
-rw-r--r--mimetypes/mimetypes.h2
-rw-r--r--mimetypes/mtint.h15
-rw-r--r--mimetypes/prloc.c15
-rw-r--r--mimetypes/yyloc.h2
-rw-r--r--src/Makefile.am6
-rw-r--r--src/catfile.c16
-rw-r--r--src/config.c16
-rw-r--r--src/dirls.c15
-rw-r--r--src/dirls.h15
-rw-r--r--src/fileserv.816
-rw-r--r--src/fileserv.c9
-rw-r--r--src/fileserv.h2
-rw-r--r--src/ftoc.sed6
-rw-r--r--src/httperr.c16
-rw-r--r--src/icon.c16
-rw-r--r--src/idx.c18
-rw-r--r--src/lang.c16
-rw-r--r--src/logger.c2
-rw-r--r--src/mem.c16
-rw-r--r--src/pidfile.c2
-rw-r--r--src/remoteip.c18
-rw-r--r--src/runas.c18
-rw-r--r--src/wordsplit.c2388
-rw-r--r--src/wordsplit.h261
-rw-r--r--src/wrapacl.c2
m---------wordsplit0
44 files changed, 492 insertions, 2691 deletions
diff --git a/.gitignore b/.gitignore
index a0f510d..67695fe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@
*.l[oa]
.emacs*
.gdbinit
+ChangeLog
Makefile
Makefile.in
aclocal.m4
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..ec3950b
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "wordsplit"]
+ path = wordsplit
+ url = git://git.gnu.org.ua/wordsplit.git
diff --git a/GNUmakefile b/GNUmakefile
new file mode 100644
index 0000000..a8ba3eb
--- /dev/null
+++ b/GNUmakefile
@@ -0,0 +1,23 @@
+# Maintainer's makefile for fileserv
+# Copyright (C) 2019-2023 Sergey Poznyakoff
+# Distributed under the terms of the GNU General Public License, either
+# version 3, or (at your option) any later version. See file COPYING
+# for the text of the license.
+
+ifneq (,$(wildcard Makefile))
+ include Makefile
+
+.PHONY: ChangeLog
+ChangeLog:
+ @perl ./git2clog.pl
+
+else
+$(if $(MAKECMDGOALS),$(MAKECMDGOALS),all): Makefile
+ $(MAKE) $(MAKECMDGOALS)
+
+Makefile: Makefile.am configure
+ ./configure
+
+configure: configure.ac
+ autoreconf -f -i -s
+endif
diff --git a/Makefile.am b/Makefile.am
index 7d86aaf..b7478fb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,4 @@
-EXTRA_DIST=README
+EXTRA_DIST=README ChangeLog wordsplit/wordsplit.c wordsplit/wordsplit.h
SUBDIRS = mimetypes src
distuninstallcheck_listfiles = find . -type f -not -name 'fileserv.conf' -print
+
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..e65cffe
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,63 @@
+fileserv -- history of user-visible changes. 2019-07-25
+See the end of file for copying conditions.
+
+Please send fileserv bug reports to <gray+fileserv@gnu.org.ua>
+
+Version 0.4.90 (git)
+
+Bugfixes
+
+Version 0.4, 2019-07-25
+
+* Bugfixes and organizational changes
+
+
+Version 0.3, 2018-04-21
+
+* Global configuration file
+
+* Per-directory configuration files
+
+* MIME type autodetection
+
+* Auto-generated directory indexes
+
+Index pages are generated from user-supplied templates. In the absense
+of these, the built-in template is used.
+
+* Listen on all available IP addresses if none is set explicitly
+
+* Configurable HTTP status handling
+
+* Handle IPv4 mapped addresses
+
+Version 0.2, 2017-10-26
+
+Initial release.
+
+
+=========================================================================
+Copyright information:
+
+Copyright (C) 2017-2023 Sergey Poznyakoff
+
+ Permission is granted to anyone to make or distribute verbatim copies
+ of this document as received, in any medium, provided that the
+ copyright notice and this permission notice are preserved,
+ thus giving the recipient permission to redistribute in turn.
+
+ Permission is granted to distribute modified versions
+ of this document, or of portions of it,
+ under the above conditions, provided also that they
+ carry prominent notices stating who last changed them.
+
+Local variables:
+mode: outline
+paragraph-separate: "[ ]*$"
+eval: (add-hook 'write-file-hooks 'time-stamp)
+time-stamp-start: "changes. "
+time-stamp-format: "%:y-%02m-%02d"
+time-stamp-end: "\n"
+end:
+
+
diff --git a/README b/README
index 3311986..16c910f 100644
--- a/README
+++ b/README
@@ -1,3 +1,6 @@
+fileserv README.
+See the end of file for copying conditions.
+
* Overview
This is a simple HTTP server for serving static files. It is suitable
@@ -72,7 +75,7 @@ When building from source package, usual incantations apply:
If you are building from a clone of the Git repository, you will need
GNU autotools to bootstrap the package first. Run
- autoreconf -f -i -s
+ ./bootstrap
in the top level source directory. This will create the configure
script and populate the directory with the missing files. Then proceed
@@ -89,14 +92,18 @@ Send bug reports to <gray+fileserv@gnu.org.ua>.
* References
-[1] Pound - http://www.apsis.ch/pound
-[2] Haproxy - http://www.haproxy.org
+[1] Pound - https://github.com/graygnuorg/pound
+ As a matter of fact, pound now provides the built-in functionality
+ for serving ACME challenges (see the ACME statement in
+ https://www.gnu.org.ua/software/pound/pound.html#HTTP_Listener).
+ It appeared long after fileserv had been released.
+[2] Haproxy - https://www.haproxy.org
[3] GNU Libmicrohttpd - https://www.gnu.org/software/libmicrohttpd
* Copyright information:
-Copyright (C) 2017-2018 Sergey Poznyakoff
+Copyright (C) 2017-2023 Sergey Poznyakoff
Permission is granted to anyone to make or distribute verbatim copies
of this document as received, in any medium, provided that the
diff --git a/bootstrap b/bootstrap
new file mode 100755
index 0000000..494dfa0
--- /dev/null
+++ b/bootstrap
@@ -0,0 +1,4 @@
+#! /bin/sh
+set -e
+git submodule update --init --recursive
+autoreconf -f -i -s
diff --git a/configure.ac b/configure.ac
index a3cfc01..f146962 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
# -*- Autoconf -*-
# This file is part of fileserv.
-# Copyright (C) 2017, 2018 Sergey Poznyakoff
+# Copyright (C) 2017-2023 Sergey Poznyakoff
#
# Fileserv is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,9 +15,9 @@
# You should have received a copy of the GNU General Public License
# along with fileserv. If not, see <http://www.gnu.org/licenses/>.
-AC_INIT([fileserv], 0.3, [gray+fileserv@gnu.org.ua])
+AC_INIT([fileserv], 0.4.90, [gray+fileserv@gnu.org.ua])
AC_CONFIG_SRCDIR([src/fileserv.c])
-AM_INIT_AUTOMAKE([1.11 foreign tar-ustar dist-xz silent-rules])
+AM_INIT_AUTOMAKE([1.15 foreign tar-ustar dist-xz silent-rules])
# Enable silent rules by default:
AM_SILENT_RULES([yes])
# Checks for programs.
@@ -43,10 +43,6 @@ AC_CHECK_LIB([wrap], [main])
AC_CHECK_LIB([nsl], [main])
AM_CONDITIONAL([FSRV_WRAP],[test x$ac_cv_lib_wrap_main = xyes])
-AM_MISSING_PROG([AUTOM4TE],[autom4te])
-AC_CONFIG_TESTDIR([mimetypes/tests])
-AC_CONFIG_FILES([mimetypes/tests/Makefile mimetypes/tests/atlocal])
-
AC_CONFIG_FILES([Makefile mimetypes/Makefile src/Makefile])
AC_OUTPUT
diff --git a/git2clog.pl b/git2clog.pl
new file mode 100644
index 0000000..cee907a
--- /dev/null
+++ b/git2clog.pl
@@ -0,0 +1,77 @@
+# Pretty simple ChangeLog generator -*-perl-*-
+# Copyright (C) 2019-2023 Sergey Poznyakoff
+# Distributed under the terms of the GNU General Public License, either
+# version 3, or (at your option) any later version. See file COPYING
+# for the text of the license.
+use strict;
+use warnings;
+
+my $name = shift @ARGV || 'ChangeLog';
+my $outfile = "$name.$$";
+
+END {
+ if (-f $outfile) {
+ unlink $outfile
+ }
+}
+
+my $header;
+
+die "must be run in a cloned source tree\n" unless -d '.git';
+
+if (-f $name) {
+ open(FH, '<', $name)
+ or die "can't open $name for reading: $!\n";
+ chomp($header = <FH>);
+ close FH
+}
+
+open(STDIN, '-|',
+ q{git log --pretty='format:<%ci>%an <%ae>%n%n%s%n%n%b%n'})
+ or die "can't run git: $!\n";
+
+open(STDOUT, '>', $outfile)
+ or die "can't open temporary file\n";
+
+my $nl = 0;
+while (<>) {
+ chomp;
+ if (/^\s*$/) {
+ $nl++;
+ } else {
+ if ($nl) {
+ print "\n";
+ $nl = 0;
+ }
+ if (s/^<([\d-]+) .*?>(.*)/$1 $2/) {
+ if (defined($header)) {
+ if ($_ eq $header) {
+ exit(0)
+ }
+ $header = undef
+ }
+ } else {
+ print "\t";
+ }
+ print "$_\n";
+ }
+}
+
+print "\f\nLocal Variables:\n";
+print <<'EOT';
+mode: change-log
+version-control: never
+buffer-read-only: t
+End:
+EOT
+;
+
+close STDOUT;
+if (-f $name) {
+ unlink $name or die "can't unlink $name: $!\n";
+}
+rename $outfile, $name or die "can't rename $outfile to $name: $!\n";
+
+
+
+
diff --git a/mimetypes/Makefile.am b/mimetypes/Makefile.am
index 3517a76..87b9af7 100644
--- a/mimetypes/Makefile.am
+++ b/mimetypes/Makefile.am
@@ -1,3 +1,19 @@
+# This file is part of fileserv.
+# Copyright (C) 2017-2023 Sergey Poznyakoff
+#
+# Fileserv is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# Fileserv is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with fileserv. If not, see <http://www.gnu.org/licenses/>.
+
noinst_LIBRARIES = libmimetypes.a
libmimetypes_a_SOURCES = \
mimetypes.h\
@@ -26,4 +42,3 @@ AM_YFLAGS=-v -t -d --name-prefix=yymt
AM_LFLAGS=-d --prefix=yymt
LEX_OUTPUT_ROOT=lex.yymt
-SUBDIRS = . tests
diff --git a/mimetypes/err.c b/mimetypes/err.c
index 125bd2f..c2085ad 100644
--- a/mimetypes/err.c
+++ b/mimetypes/err.c
@@ -1,3 +1,19 @@
+/* This file is part of fileserv.
+ Copyright (C) 2017-2023 Sergey Poznyakoff
+
+ Fileserv is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ Fileserv is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with fileserv. If not, see <http://www.gnu.org/licenses/>. */
+
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
diff --git a/mimetypes/eval.c b/mimetypes/eval.c
index 120d041..0978780 100644
--- a/mimetypes/eval.c
+++ b/mimetypes/eval.c
@@ -1,3 +1,19 @@
+/* This file is part of fileserv.
+ Copyright (C) 2017-2023 Sergey Poznyakoff
+
+ Fileserv is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ Fileserv is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with fileserv. If not, see <http://www.gnu.org/licenses/>. */
+
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
diff --git a/mimetypes/grammar.y b/mimetypes/grammar.y
index 1864289..d8321ae 100644
--- a/mimetypes/grammar.y
+++ b/mimetypes/grammar.y
@@ -1,6 +1,6 @@
%{
/* This file is part of fileserv.
- Copyright (C) 2017, 2018 Sergey Poznyakoff
+ Copyright (C) 2017-2023 Sergey Poznyakoff
Fileserv is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/mimetypes/ident.c b/mimetypes/ident.c
index 6478e76..81390a0 100644
--- a/mimetypes/ident.c
+++ b/mimetypes/ident.c
@@ -1,3 +1,18 @@
+/* This file is part of fileserv.
+ Copyright (C) 2017-2023 Sergey Poznyakoff
+
+ Fileserv is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ Fileserv is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with fileserv. If not, see <http://www.gnu.org/licenses/>. */
#include <stdlib.h>
#include <errno.h>
#include <string.h>
diff --git a/mimetypes/lexer.l b/mimetypes/lexer.l
index dbd12a1..060879e 100644
--- a/mimetypes/lexer.l
+++ b/mimetypes/lexer.l
@@ -1,6 +1,6 @@
%top {
/* This file is part of fileserv.
- Copyright (C) 2017, 2018 Sergey Poznyakoff
+ Copyright (C) 2017-2023 Sergey Poznyakoff
Fileserv is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -359,7 +359,7 @@ lex_next_rule (void)
YY_LOCATION_PRINT (stderr, yylloc);
fprintf (stderr, ": started error recovery\n");
}
- while ((c = input ()) != EOF)
+ while ((c = input ()) != EOF && c != 0)
{
char ch = c;
if (!isspace (c) && linetrack_at_bol (trk))
diff --git a/mimetypes/linetrack.c b/mimetypes/linetrack.c
index dda1636..a160f5d 100644
--- a/mimetypes/linetrack.c
+++ b/mimetypes/linetrack.c
@@ -1,5 +1,5 @@
/* This file is part of fileserv.
- Copyright (C) 2017, 2018 Sergey Poznyakoff
+ Copyright (C) 2017-2023 Sergey Poznyakoff
Fileserv is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/mimetypes/locus.c b/mimetypes/locus.c
index e3eba86..d2d2870 100644
--- a/mimetypes/locus.c
+++ b/mimetypes/locus.c
@@ -1,5 +1,5 @@
/* This file is part of fileserv.
- Copyright (C) 2017, 2018 Sergey Poznyakoff
+ Copyright (C) 2017-2023 Sergey Poznyakoff
Fileserv is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/mimetypes/locus.h b/mimetypes/locus.h
index 8a56995..7ba1038 100644
--- a/mimetypes/locus.h
+++ b/mimetypes/locus.h
@@ -1,5 +1,5 @@
/* This file is part of fileserv.
- Copyright (C) 2017, 2018 Sergey Poznyakoff
+ Copyright (C) 2017-2023 Sergey Poznyakoff
Fileserv is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/mimetypes/mimetypes.h b/mimetypes/mimetypes.h
index 0cf2688..b86004a 100644
--- a/mimetypes/mimetypes.h
+++ b/mimetypes/mimetypes.h
@@ -1,3 +1,3 @@
-void (*mimetypes_error_printer) (char const *);
+extern void (*mimetypes_error_printer) (char const *);
int mimetypes_parse (const char *name);
const char *get_file_type (char const *filename);
diff --git a/mimetypes/mtint.h b/mimetypes/mtint.h
index a3324d1..2b778c5 100644
--- a/mimetypes/mtint.h
+++ b/mimetypes/mtint.h
@@ -1,3 +1,18 @@
+/* This file is part of fileserv.
+ Copyright (C) 2017-2023 Sergey Poznyakoff
+
+ Fileserv is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ Fileserv is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with fileserv. If not, see <http://www.gnu.org/licenses/>. */
#include <stdlib.h>
#include <stdio.h>
#include <regex.h>
diff --git a/mimetypes/prloc.c b/mimetypes/prloc.c
index 4555a56..018de9d 100644
--- a/mimetypes/prloc.c
+++ b/mimetypes/prloc.c
@@ -1,3 +1,18 @@
+/* This file is part of fileserv.
+ Copyright (C) 2017-2023 Sergey Poznyakoff
+
+ Fileserv is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ Fileserv is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with fileserv. If not, see <http://www.gnu.org/licenses/>. */
#include <stdlib.h>
#include <errno.h>
#include "locus.h"
diff --git a/mimetypes/yyloc.h b/mimetypes/yyloc.h
index bb76d60..87af6ed 100644
--- a/mimetypes/yyloc.h
+++ b/mimetypes/yyloc.h
@@ -1,5 +1,5 @@
/* This file is part of fileserv.
- Copyright (C) 2017, 2018 Sergey Poznyakoff
+ Copyright (C) 2017-2023 Sergey Poznyakoff
Fileserv is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/src/Makefile.am b/src/Makefile.am
index dcefc04..7bc1f9e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,14 +1,16 @@
sbin_PROGRAMS=fileserv
fileserv_SOURCES=fileserv.c runas.c fileserv.h logger.c pidfile.c\
- wordsplit.c wordsplit.h catfile.c config.c idx.c defidx.h\
+ catfile.c config.c idx.c defidx.h\
mem.c remoteip.c icon.c dirls.c dirls.h lang.c httperr.c
+nodist_fileserv_SOURCES=wordsplit.c wordsplit.h
BUILT_SOURCES=defidx.h
if FSRV_WRAP
fileserv_SOURCES += wrapacl.c
endif
dist_man_MANS=fileserv.8
LDADD = ../mimetypes/libmimetypes.a
-AM_CPPFLAGS = -I $(top_srcdir)/mimetypes -DSYSCONFDIR=\"$(sysconfdir)\"
+VPATH += $(top_srcdir)/wordsplit
+AM_CPPFLAGS = -I $(top_srcdir)/wordsplit -I $(top_srcdir)/mimetypes -DSYSCONFDIR=\"$(sysconfdir)\"
EXTRA_DIST=ftoc.sed defidx.html fileserv.conf
.html.h:
$(AM_V_GEN)sed -f $(srcdir)/ftoc.sed $< > $@
diff --git a/src/catfile.c b/src/catfile.c
index bc4080a..65785f6 100644
--- a/src/catfile.c
+++ b/src/catfile.c
@@ -1,3 +1,19 @@
+/* This file is part of fileserv.
+ Copyright (C) 2017-2023 Sergey Poznyakoff
+
+ Fileserv is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ Fileserv is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with fileserv. If not, see <http://www.gnu.org/licenses/>. */
+
#include <stdlib.h>
#include <string.h>
#include "fileserv.h"
diff --git a/src/config.c b/src/config.c
index 19b26c7..c0f3d42 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1,3 +1,19 @@
+/* This file is part of fileserv.
+ Copyright (C) 2017-2023 Sergey Poznyakoff
+
+ Fileserv is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ Fileserv is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with fileserv. If not, see <http://www.gnu.org/licenses/>. */
+
#include "fileserv.h"
#include <errno.h>
#include <string.h>
diff --git a/src/dirls.c b/src/dirls.c
index de75f60..88a4c77 100644
--- a/src/dirls.c
+++ b/src/dirls.c
@@ -1,3 +1,18 @@
+/* This file is part of fileserv.
+ Copyright (C) 2017-2023 Sergey Poznyakoff
+
+ Fileserv is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ Fileserv is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with fileserv. If not, see <http://www.gnu.org/licenses/>. */
#include "fileserv.h"
#include "dirls.h"
#include <errno.h>
diff --git a/src/dirls.h b/src/dirls.h
index 7ec2f3e..33514cf 100644
--- a/src/dirls.h
+++ b/src/dirls.h
@@ -1,3 +1,18 @@
+/* This file is part of fileserv.
+ Copyright (C) 2017-2023 Sergey Poznyakoff
+
+ Fileserv is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3, or (at your option)
+ any later version.
+
+ Fileserv is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with fileserv. If not, see <http://www.gnu.org/licenses/>. */
typedef struct dirlsent {
char *name; /* File name */
struct stat st; /* Meta-data */
diff --git a/src/fileserv.8 b/src/fileserv.8
index 500e153..8dbf6ad 100644
--- a/src/fileserv.8
+++ b/src/fileserv.8
@@ -1,5 +1,5 @@
.\" This file is part of fileserv -*- nroff -*-
-.\" Copyright (C) 2017, 2018 Sergey Poznyakoff
+.\" Copyright (C) 2017-2023 Sergey Poznyakoff
.\"
.\" Fileserv is free software; you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
@@ -13,7 +13,7 @@
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with fileserv. If not, see <http://www.gnu.org/licenses/>.
-.TH FILESERV 8 "April 23, 2018" "FILESERV" "User Commands"
+.TH FILESERV 8 "February 16, 2023" "FILESERV" "User Commands"
.SH NAME
fileserv \- simple http server for static files
.SH SYNOPSIS
@@ -177,7 +177,7 @@ are:
.BR auth ,
.BR authpriv ,
.BR cron ,
-.BR daemon "(default), "
+.BR daemon " (default), "
.BR ftp ,
.BR kern ,
.BR lpr ,
@@ -496,8 +496,16 @@ This function is useful to create listing ordering menu, e.g.:
<a href="?C=S&amp;O={% $(sortorder S) %}">Size</a>
</th>
.EE
+.\" The MANCGI variable is set by man.cgi script on Ulysses.
+.\" The download.inc file contains the default DOWNLOAD section
+.\" for man-based doc pages.
+.if "\V[MANCGI]"WEBDOC" \{\
+. ds package fileserv
+. ds version 0.4
+. so download.inc
+\}
.SH COPYRIGHT
-Copyright \(co 2017, 2018 Sergey Poznyakoff
+Copyright \(co 2017--2019 Sergey Poznyakoff
.br
.na
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
diff --git a/src/fileserv.c b/src/fileserv.c
index 568ba37..00521bd 100644
--- a/src/fileserv.c
+++ b/src/fileserv.c
@@ -1,5 +1,5 @@
/* This file is part of fileserv.
- Copyright (C) 2017, 2018 Sergey Poznyakoff
+ Copyright (C) 2017-2023 Sergey Poznyakoff
Fileserv is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -62,7 +62,7 @@ usage(void)
printf("\n");
}
-const char version_copyright[] = "Copyright (C) 2017-2018 Sergey Poznyakoff";
+const char version_copyright[] = "Copyright (C) 2017-2023 Sergey Poznyakoff";
const char gplv3[] = "\
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n\
This is free software: you are free to change and redistribute it.\n\
@@ -588,11 +588,10 @@ fileserv_handler(void *cls,
return http_error(conn, method, url,
MHD_HTTP_METHOD_NOT_ALLOWED);
- if (&aptr != *con_cls) {
+ if (*con_cls == NULL) {
*con_cls = &aptr;
return MHD_YES;
}
- *con_cls = NULL;
status = get_file_resp(conn, url, &resp);
switch (status) {
@@ -661,9 +660,9 @@ http_server(int fd, struct sockaddr *server_addr)
| MHD_USE_ERROR_LOG, 0,
fileserv_acl, server_addr,
fileserv_handler, NULL,
- MHD_OPTION_LISTEN_SOCKET, fd,
MHD_OPTION_EXTERNAL_LOGGER, fileserv_logger,
NULL,
+ MHD_OPTION_LISTEN_SOCKET, fd,
MHD_OPTION_END);
/* Unblock only the fatal signals */
sigdelset(&sigs, SIGPIPE);
diff --git a/src/fileserv.h b/src/fileserv.h
index a801ed4..4