Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 08 Apr 2002 10:29:51 +0800
From:      Eugene Grosbein <eugen@svzserv.kemerovo.su>
To:        asmodai@FreeBSD.org
Cc:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/29725: [PATCH] Fixed segmentation fault in simple_httpd and some  other bugfixes
Message-ID:  <3CB1009F.FA6648DB@svzserv.kemerovo.su>
References:  <200204072006.g37K6gj71982@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
asmodai@FreeBSD.org wrote:
> 
> Synopsis: [PATCH] Fixed segmentation fault in simple_httpd and some other bugfixes
> 
> State-Changed-From-To: open->analyzed
> State-Changed-By: asmodai
> State-Changed-When: Sun Apr 7 13:06:23 PDT 2002
> State-Changed-Why:
> I am already working on this.
> 
> http://www.freebsd.org/cgi/query-pr.cgi?pr=29725

That my patch was not tested well and contains some bugs. 
I've greatly improved simple_httpd since then keeping it useful for Pico.
Now my variant is heavily tested and is used in production for long time.

Here is ChangeLog.

2002-01-11 16:29  eugen

        * simple_httpd.c: SIGBUS fixed for 'GET /'

2002-01-04 20:13  eugen

        * README.rus: Change log in Russian

2002-01-04 18:51  eugen

        * Makefile, simple_httpd.c: Forced commit as the previous one did
        not include commit log.
        
        Server can now use FreeBSD http accept filter.  Compile it using
        make SHTTP_USE_ACCF=yes and enable with command line option -a.
        
        Read accf_http(9) about accept filtes benefits.

2002-01-04 18:44  eugen

        * Makefile, simple_httpd.c: /tmp/cvsahJVTt

2001-12-27 01:20  eugen

        * simple_httpd.c: Get copyright back - it was removed by mistake

2001-12-25 19:27  eugen

        * simple_httpd.c: Do not include <sys/uio.h> as we do not actually
        need this.

2001-12-25 19:25  eugen

        * Makefile, simple_httpd.c: Build with SHTTPD_USE_SENDFILE=yes to
        use sendfile(2) instead of read/write loop. This gives minor
        descrease of stack usage, small descrease of code and greatly
        improves performance. Take a look to the LINT, however.  You may
        wish to tune kernel option NSFBUFS.

2001-11-18 21:34  eugen

        * Makefile, simple_httpd.c: 1. Make it compile cleanly with gcc
        2.95.3. CFLAGS now includes -Wno-format.  2. Optional support for
        %-encoded URLs.     Use make SHTTPD_URLENCODE=yes to compile this
        in.  3. Fixed SIGSEGV that occured when server was compiled with   
        SHTTPD_USE_SYSLOG and SHTTPD_USE_TCP_WRAPPERS and was started
        without -w.

2001-08-30 15:53  eugen

        * simple_httpd.c: Use LOG_WARNING instead of LOG_ERROR for non-fatal
        errors

2001-08-27 12:53  eugen

        * Makefile, simple_httpd.c: The server will use setproctitle(3) to
        show it's internal state if compiled with SHTTPD_USE_SETPROCTITLE. 
        The title will include client's address if compiled with both of
        SHTTPD_USE_SETPROCTITLE and SHTTPD_USE_TCP_WRAPPERS.

2001-08-23 22:24  eugen

        * mime_t.h, simple_httpd.c: Close server socket after fork() while
        serving request

2001-08-23 18:24  eugen

        * simple_httpd.c: Make it possible build with hosts_access(5)
        support but without syslog(3).

2001-08-23 18:19  eugen

        * Makefile: Fix typo in Makefile

2001-08-23 18:07  eugen

        * Makefile, simple_httpd.c: Now there is no need to edit Makefile. 
        Try building this in way: make SHTTP_USE_SYSLOG=yes ...

2001-08-23 17:45  eugen

        * Makefile, simple_httpd.c: Optional logging via syslog() added.
        Logging facility is daemon.  To enable this, define
        SHTTPD_USE_SYSLOG and recompile.  By default, syslog prefix is
        'simple_httpd' but this can be overriden using command line option
        -s servname.  The length of 'servname' should be less than 32
        characters.
        
        Support for TCP Wrappers added, see hosts_access(5).  To enable
        this, define SHTTPD_USE_TCP_WRAPPERS and recompile.  Use command
        line option -w to activate this.  Service name is also set with
        option -s servname.  If syslogging is enabled, refused connections
        will be logged with auth.warning facility/severity.
        
        Timeout for reading of request is implemented.  Default timeout
        value is 10 seconds but this can be overriden using command line
        option -t timeout.
        
        simple_httpd now does not allow zombies to float around
        
        Now server does not segfault even if there is no HOME environment
        variable.  In this case it will try to use '/' as HOME.
        
        Now server will try to create log if it does not exists instead of
        complaining. Current umask will define access rights for logfile.
        
        Now server uses system's default value of backlog for accept()
        instead of limiting it to 15.

2001-08-19 20:58  eugen

        * simple_httpd.c: Check if file is really opened

2001-08-17 21:12  eugen

        * Makefile, simple_httpd.c: 'Verbose output' code made optional via
        Makefile

2001-08-17 21:07  eugen

        * simple_httpd.c: Don't use prepare env_host and env_addr if CGI
        handling is disabled

2001-08-17 20:54  eugen

        * Makefile, simple_httpd.c: Support for restarting for broken
        downloads is added.  CGI handling now is optional (via editing of
        Makefile)

2001-08-16 17:43  eugen

        * simple_httpd.c: Return error 501 instead of 404 for empty request

2001-08-16 17:35  eugen

        * simple_httpd.c: HTTP error 405 is not valid HTTP/1.0 response. 
        Replaced with 501 and 404.

2001-08-16 16:51  eugen

        * simple_httpd.c: http_request() optimized and possible
        segmentation fault avoided

2001-08-16 15:51  eugen

        * simple_httpd.c: Last strcat()'s replaced with strncat()'s

2001-08-16 15:49  eugen

        * simple_httpd.c: log_line() rewritten in more secure and less
        memory consuming way.  Syntax errors from previous commits are
        fixed.

2001-08-16 15:24  eugen

        * simple_httpd.c: Replace all unsafe strcpy() with safe strncpy().

2001-08-16 15:14  eugen

        * simple_httpd.c: Fixed possible call close() on uninitialized
        variable

2001-08-16 15:12  eugen

        * simple_httpd.c: Fixed possible buffer overflow: strcpy replaced
        with copying of pointers which is more efficient also.

2001-08-16 15:06  eugen

        * simple_httpd.c: Decrease memory usage (buffer size)

2001-08-16 14:50  eugen

        * Makefile, simple_httpd.c: Make it compile cleanly with gcc -ansi
        -pedantic -Wall

2001-08-15 17:32  eugen

        * simple_httpd.c: Add missing 'break' into loop that searches for
        'Content-type' which may be only one

2001-08-15 17:19  eugen

        * simple_httpd.c: off_t is long long int, print it with "%lld"
        format string instead of "%d"

2001-08-15 17:17  eugen

        * mime_t.h, simple_httpd.c: Introduce array mime_type[][] for
        mapping of file extentions to mime types and string
        default_mime_type for unknown/missing extentions.

2001-08-15 16:18  eugen

        * simple_httpd.c: Comment out unused variables bflad, fd, lg in
        main()

2001-08-15 16:15  eugen

        * simple_httpd.c: Comment out unused variables ld, http1, msg in
        http_request()

2001-08-15 15:44  eugen

        * simple_httpd.c: Fixed format string for debug output (missing %d
        added)

2001-08-15 12:42  eugen

        * simple_httpd.c: It's not enough to prepare 'Content-length'
        header, we need also send it :)

2001-08-15 12:39  eugen

        * simple_httpd.c: Fix segmentation fault when serving request of
        file without '.' in the name

2001-08-15 12:09  eugen

        * Makefile, README, simple_httpd.c: Initial revision

2001-08-15 12:09  eugen

        * Makefile, README, simple_httpd.c: Initial import of
        PicoBSD/TinyWare's simpe_httpd


You can get patched version from here:
ftp://www.kuzbass.ru/pub/freebsd/simple_httpd.tar.bz2
Feel free to edit it if you'll commit this.

Eugene Grosbein

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3CB1009F.FA6648DB>