NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/38466: cvsweb does not work with httpd



The following reply was made to PR bin/38466; it has been noted by GNATS.

From: Holger Weiss <holger%weiss.in-berlin.de@localhost>
To: Arto Huusko <arto.huusko%pp2.inet.fi@localhost>,
        Matthew Green <mrg%eterna.com.au@localhost>
Cc: GNATS Bugs <gnats-bugs%NetBSD.org@localhost>,
        GNATS Admin <gnats-admin%NetBSD.org@localhost>,
        NetBSD Bugs <netbsd-bugs%NetBSD.org@localhost>
Subject: Re: bin/38466: cvsweb does not work with httpd
Date: Sat, 3 May 2008 16:01:33 +0200

 --HcAYCG3uE/tztfnV
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 Well, supporting configurations such as "-C .sh /bin/sh -x index.sh"
 might be useful for some sites.  I use the attached patch which appends
 the `index.html' name to the URL <http://example.com/cgi-bin/>, but not
 to <http://example.com/cgi-bin/script/info/>.  The patch doesn't change
 the current behaviour for CGI scripts outside the `cgibin' directory,
 since bozohttpd doesn't provide PATH_INFO to those anyway.
 
 --HcAYCG3uE/tztfnV
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="2.cgibin-index-html.diff"
 
 Index: cgi-bozo.c
 ===================================================================
 RCS file: /cvsroot/src/libexec/httpd/cgi-bozo.c,v
 retrieving revision 1.7
 diff -u -r1.7 cgi-bozo.c
 --- cgi-bozo.c 3 Mar 2008 22:15:09 -0000       1.7
 +++ cgi-bozo.c 3 May 2008 13:45:08 -0000
 @@ -60,6 +60,7 @@
  static        const char *    content_cgihandler(http_req *, const char *);
  static        void            finish_cgi_output(http_req *request, int, int);
  static        int             parse_header(const char *, ssize_t, char **, 
char **);
 +static        void            append_index_html(char **);
  
  void
  set_cgibin(char *path)
 @@ -118,16 +119,12 @@
        info = NULL;
  
        len = strlen(url);
 -      if (len == 0 || url[len - 1] == '/') {  /* append index.html */
 -              debug((DEBUG_FAT, "appending index.html"));
 -              url = bozorealloc(url, len + strlen(index_html) + 1);
 -              strcat(url, index_html);
 -              debug((DEBUG_NORMAL, "process_cgi: url adjusted to `%s'", url));
 -      }
  
        auth_check(request, url + 1);
  
        if (!cgibin || strncmp(url + 1, CGIBIN_PREFIX, CGIBIN_PREFIX_LEN) != 0) 
{
 +              if (len == 0 || url[len - 1] == '/')
 +                      append_index_html(&url);
                cgihandler = content_cgihandler(request, url + 1);
                if (cgihandler == NULL) {
                        free(url);
 @@ -135,7 +132,8 @@
                }
                debug((DEBUG_NORMAL, "process_cgi: cgihandler `%s'",
                    cgihandler));
 -      }
 +      } else if (len - 1 == CGIBIN_PREFIX_LEN)        /* url is "/cgi-bin/" */
 +              append_index_html(&url);
  
        ix = 0;
        if (cgihandler) {
 @@ -430,6 +428,15 @@
        return (NULL);
  }
  
 +static void
 +append_index_html(char **url)
 +{
 +      debug((DEBUG_FAT, "appending index.html"));
 +      *url = bozorealloc(*url, strlen(*url) + strlen(index_html) + 1);
 +      strcat(*url, index_html);
 +      debug((DEBUG_NORMAL, "append_index_html: url adjusted to `%s'", *url));
 +}
 +
  #ifndef NO_DYNAMIC_CONTENT
  /* cgi maps are simple ".postfix /path/to/prog" */
  void
 
 --HcAYCG3uE/tztfnV--
 


Home | Main Index | Thread Index | Old Index