From 0b36f29cd5f476e1b9d71c58bb62fd5960111cdf Mon Sep 17 00:00:00 2001 From: dmcmahill Date: Fri, 2 Aug 2002 02:05:44 +0000 Subject: fix compilation with -Werror enabled on netbsd-1.5.3/alpha. patch from Matt Green. --- www/bozohttpd/distinfo | 3 +- www/bozohttpd/patches/patch-ac | 702 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 704 insertions(+), 1 deletion(-) create mode 100644 www/bozohttpd/patches/patch-ac (limited to 'www/bozohttpd') diff --git a/www/bozohttpd/distinfo b/www/bozohttpd/distinfo index bf0d4e97cf5..5d763bb4f45 100644 --- a/www/bozohttpd/distinfo +++ b/www/bozohttpd/distinfo @@ -1,6 +1,7 @@ -$NetBSD: distinfo,v 1.12 2002/07/30 13:40:53 wiz Exp $ +$NetBSD: distinfo,v 1.13 2002/08/02 02:05:44 dmcmahill Exp $ SHA1 (bozohttpd-5.11.tar.bz2) = 82b8326bcdcf20dc431a41c6bcc1f585326be5a4 Size (bozohttpd-5.11.tar.bz2) = 24198 bytes SHA1 (patch-aa) = 65b36db037dbf40b8c9855b3ca957aa96eff064d SHA1 (patch-ab) = 24cc57867ecf94617a78025baf31c2f050d42470 +SHA1 (patch-ac) = 3d97e3b2bb0f61265576c548cff35c9b6ca09713 diff --git a/www/bozohttpd/patches/patch-ac b/www/bozohttpd/patches/patch-ac new file mode 100644 index 00000000000..95ea53c3fbd --- /dev/null +++ b/www/bozohttpd/patches/patch-ac @@ -0,0 +1,702 @@ +$NetBSD: patch-ac,v 1.5 2002/08/02 02:05:45 dmcmahill Exp $ + +fixes compiler warnings which caused the build to fail with -Werror + +*** bozohttpd.c 2002/07/30 10:17:00 1.39 +--- bozohttpd.c 2002/08/01 14:20:36 1.40 +*************** +*** 1,4 **** +! /* $eterna: bozohttpd.c,v 1.39 2002/07/30 10:17:00 mrg Exp $ */ + + /* + * Copyright (c) 1997, 1998, 1999, 2000, 2001 Matthew R. Green +--- 1,4 ---- +! /* $eterna: bozohttpd.c,v 1.40 2002/08/01 14:20:36 mrg Exp $ */ + + /* + * Copyright (c) 1997, 1998, 1999, 2000, 2001 Matthew R. Green +*************** +*** 174,181 **** + + /* headers */ + struct _headers { +! char *header; +! char *value; + SIMPLEQ_ENTRY(_headers) next; + }; + +--- 174,181 ---- + + /* headers */ + struct _headers { +! const char *header; +! const char *value; + SIMPLEQ_ENTRY(_headers) next; + }; + +*************** typedef struct { +*** 190,205 **** + #define HTTP_DELETE 0x06 /* not supported */ + #define HTTP_TRACE 0x07 /* not supported */ + #define HTTP_CONNECT 0x08 /* not supported */ +! char *methodstr; + char *url; +! char *proto; +! char *content_type; +! char *content_length; +! char *allow; +! char *host; /* HTTP/1.1 Host: */ +! char *remotehost; +! char *remoteaddr; +! char *serverport; + SIMPLEQ_HEAD(, _headers) headers; + int nheaders; + } http_req; +--- 190,205 ---- + #define HTTP_DELETE 0x06 /* not supported */ + #define HTTP_TRACE 0x07 /* not supported */ + #define HTTP_CONNECT 0x08 /* not supported */ +! const char *methodstr; + char *url; +! const char *proto; +! const char *content_type; +! const char *content_length; +! const char *allow; +! const char *host; /* HTTP/1.1 Host: */ +! const char *remotehost; +! const char *remoteaddr; +! const char *serverport; + SIMPLEQ_HEAD(, _headers) headers; + int nheaders; + } http_req; +*************** static void process_cgi (http_req *); +*** 225,231 **** + + #ifndef NO_USER_SUPPORT + static int uflag; /* allow /~user/ translation */ +! static char *public_html = PUBLIC_HTML; + + static char *transform_user (http_req *, int *); + #endif /* NO_USER_SUPPORT */ +--- 225,231 ---- + + #ifndef NO_USER_SUPPORT + static int uflag; /* allow /~user/ translation */ +! static const char *public_html = PUBLIC_HTML; + + static char *transform_user (http_req *, int *); + #endif /* NO_USER_SUPPORT */ +*************** static char *transform_user (http_req *, +*** 234,240 **** + #ifndef NO_DIRINDEX_SUPPORT + static int Xflag; /* do directory indexing */ + +! static void directory_index (http_req *, char *); + #endif /* NO_DIRINDEX_SUPPORT */ + + +--- 234,240 ---- + #ifndef NO_DIRINDEX_SUPPORT + static int Xflag; /* do directory indexing */ + +! static void directory_index (http_req *, const char *); + #endif /* NO_DIRINDEX_SUPPORT */ + + +*************** static int bflag; /* background; drop i +*** 242,248 **** + static int eflag; /* don't clean environ; -t/-U only. */ + #ifndef NO_DAEMON_MODE + static char *iflag; /* bind address; default INADDR_ANY. */ +! static char *Iflag = "http";/* bind port; default "http". */ + static int sock = -1; /* bound socket. */ + + static void sigchild (int); /* SIGCHLD handler. */ +--- 242,248 ---- + static int eflag; /* don't clean environ; -t/-U only. */ + #ifndef NO_DAEMON_MODE + static char *iflag; /* bind address; default INADDR_ANY. */ +! static const char *Iflag = "http";/* bind port; default "http". */ + static int sock = -1; /* bound socket. */ + + static void sigchild (int); /* SIGCHLD handler. */ +*************** static void sigchild (int); /* SIGCHLD h +*** 252,258 **** + #ifdef DEBUG + static int dflag = 0; /* debugging level */ + +! static void debug__ (int, char *, ...); + #define debug(x) debug__ x + #else + #define debug(x) +--- 252,258 ---- + #ifdef DEBUG + static int dflag = 0; /* debugging level */ + +! static void debug__ (int, const char *, ...); + #define debug(x) debug__ x + #else + #define debug(x) +*************** static char *vpath; /* virtual director +*** 269,276 **** + + static char date[40]; /* text date string */ + +! static char *server_software = "bozohttpd/5.11"; +! static char *index_html = INDEX_HTML; + static char http_09[] = "HTTP/0.9"; + static char http_10[] = "HTTP/1.0"; + static char http_11[] = "HTTP/1.1"; +--- 269,276 ---- + + static char date[40]; /* text date string */ + +! static const char *server_software = "bozohttpd/5.11"; +! static const char *index_html = INDEX_HTML; + static char http_09[] = "HTTP/0.9"; + static char http_10[] = "HTTP/1.0"; + static char http_11[] = "HTTP/1.1"; +*************** static http_req *read_request (void); +*** 285,310 **** + static void process_request (http_req *); + static char *transform_request (http_req *, int *); + static void handle_redirect (http_req *, char *); +! static void print_header (http_req *, struct stat *, char *, char *); + + static void check_virtual (http_req *); + static void fix_url_percent (http_req *); +! static void process_method (http_req *, char *); +! static void process_proto (http_req *, char *); +! static char *content_type (http_req *, char *); +! static char *content_encoding (http_req *, char *); + + static void set_http_date (void); + +! static void warning (char *, ...); +! static void error (int, char *, ...); + +! static void http_error (int, http_req *, char *); +! static char *http_errors_short (int); +! static char *http_errors_long (int); + + static char *dgetln (int, ssize_t *); +! static char *strnsep (char **, char *, ssize_t *); + + int main (int, char *[]); + +--- 285,310 ---- + static void process_request (http_req *); + static char *transform_request (http_req *, int *); + static void handle_redirect (http_req *, char *); +! static void print_header (http_req *, struct stat *, const char *, const char *); + + static void check_virtual (http_req *); + static void fix_url_percent (http_req *); +! static void process_method (http_req *, const char *); +! static void process_proto (http_req *, const char *); +! static const char *content_type (http_req *, const char *); +! static const char *content_encoding (http_req *, const char *); + + static void set_http_date (void); + +! static void warning (const char *, ...); +! static void error (int, const char *, ...); + +! static void http_error (int, http_req *, const char *); +! static const char *http_errors_short (int); +! static const char *http_errors_long (int); + + static char *dgetln (int, ssize_t *); +! static char *strnsep (char **, const char *, ssize_t *); + + int main (int, char *[]); + +*************** process_request(request) +*** 882,888 **** + http_req *request; + { + struct stat sb; +! char *file, *type, *encoding; + int fd, isindex; + + /* note that transform_request chdir()'s if required */ +--- 882,889 ---- + http_req *request; + { + struct stat sb; +! char *file; +! const char *type, *encoding; + int fd, isindex; + + /* note that transform_request chdir()'s if required */ +*************** process_request(request) +*** 961,967 **** + void + directory_index(request, dirname) + http_req *request; +! char *dirname; + { + struct stat sb; + struct dirent *de; +--- 962,968 ---- + void + directory_index(request, dirname) + http_req *request; +! const char *dirname; + { + struct stat sb; + struct dirent *de; +*************** check_virtual(request) +*** 1094,1103 **** + s = strchr(url, '/'); + /* HTTP/1.1 draft rev-06, 5.2: URI takes precedence over Host: */ + request->host = url; +! if (s) { + request->url = strdup(s); +! *s = 0; +! } else + request->url = strdup("/"); + if (request->url == NULL) + http_error(500, request, "strdup failed"); +--- 1095,1103 ---- + s = strchr(url, '/'); + /* HTTP/1.1 draft rev-06, 5.2: URI takes precedence over Host: */ + request->host = url; +! if (s) + request->url = strdup(s); +! else + request->url = strdup("/"); + if (request->url == NULL) + http_error(500, request, "strdup failed"); +*************** transform_request(request, isindex) +*** 1159,1165 **** + http_req *request; + int *isindex; + { +! char *file, *url; + size_t len; + + file = NULL; /* XXX gcc */ +--- 1159,1166 ---- + http_req *request; + int *isindex; + { +! char *file; +! char *url; + size_t len; + + file = NULL; /* XXX gcc */ +*************** void +*** 1372,1379 **** + print_header(request, sbp, type, encoding) + http_req *request; + struct stat *sbp; +! char *type; +! char *encoding; + { + + (void)printf("Date: %s\r\n", date); +--- 1373,1380 ---- + print_header(request, sbp, type, encoding) + http_req *request; + struct stat *sbp; +! const char *type; +! const char *encoding; + { + + (void)printf("Date: %s\r\n", date); +*************** process_cgi(request) +*** 1407,1428 **** + http_req *request; + { + struct _headers *headp; +! char *info, *type, *clen, *query, *s, *t, +! *path, *env, *command = NULL, *fullcommand, + *url = strdup(request->url + CGIBIN_PREFIX_LEN); + char **envp, *argv[3]; + int envpsize, ix; + + if (url == NULL) +! http_error(500, request, "malloc failed"); + query = path = NULL; + envp = NULL; + + debug((DEBUG_FAT, "process_cgi: writing HTTP header ..")); + +- if (url == NULL) +- http_error(500, request, "strdup failed"); +- + if (request->method == HTTP_HEAD) + goto print_cgi_header; + +--- 1408,1427 ---- + http_req *request; + { + struct _headers *headp; +! const char *type, *clen; +! char *info, *query, *s, *t, *path, *env, *fullcommand, +! *command = NULL, + *url = strdup(request->url + CGIBIN_PREFIX_LEN); + char **envp, *argv[3]; + int envpsize, ix; + + if (url == NULL) +! http_error(500, request, "strdup failed"); + query = path = NULL; + envp = NULL; + + debug((DEBUG_FAT, "process_cgi: writing HTTP header ..")); + + if (request->method == HTTP_HEAD) + goto print_cgi_header; + +*************** process_cgi(request) +*** 1434,1440 **** + command[s - url - 1] = '\0'; + url = info = s; + } else +! info = ""; + + if (command == NULL) { + command = url; +--- 1433,1439 ---- + command[s - url - 1] = '\0'; + url = info = s; + } else +! (const char *)info = ""; + + if (command == NULL) { + command = url; +*************** do { \ +*** 1484,1489 **** +--- 1483,1489 ---- + + for (headp = request->headers.sqh_first; headp; + headp = headp->next.sqe_next) { ++ const char *s2; + env = malloc(6 + strlen(headp->header) + 1 + + strlen(headp->value)); + if (env == NULL) +*************** do { \ +*** 1492,1504 **** + t = env; + strcpy(t, "HTTP_"); + t += strlen(t); +! for (s = headp->header; *s; t++, s++) +! if (islower(*s)) +! *t = toupper(*s); +! else if (*s == '-') + *t = '_'; + else +! *t = *s; + *t = '\0'; + debug((DEBUG_OBESE, "setting header %s as %s = %s", + headp->header, env, headp->value)); +--- 1492,1504 ---- + t = env; + strcpy(t, "HTTP_"); + t += strlen(t); +! for (s2 = headp->header; *s2; t++, s2++) +! if (islower(*s2)) +! *t = toupper(*s2); +! else if (*s2 == '-') + *t = '_'; + else +! *t = *s2; + *t = '\0'; + debug((DEBUG_OBESE, "setting header %s as %s = %s", + headp->header, env, headp->value)); +*************** fix_url_percent(request) +*** 1600,1606 **** + # method type. + */ + static struct method_map { +! char *name; + int type; + } method_map[] = { + { "GET", HTTP_GET, }, +--- 1600,1606 ---- + # method type. + */ + static struct method_map { +! const char *name; + int type; + } method_map[] = { + { "GET", HTTP_GET, }, +*************** static struct method_map { +*** 1619,1625 **** + static void + process_method(request, method) + http_req *request; +! char *method; + { + struct method_map *mmp; + +--- 1619,1625 ---- + static void + process_method(request, method) + http_req *request; +! const char *method; + { + struct method_map *mmp; + +*************** process_method(request, method) +*** 1642,1650 **** + static void + process_proto(request, proto) + http_req *request; +! char *proto; + { +! char *majorstr, *minorstr; + int majorint, minorint; + + if (proto == NULL) { +--- 1642,1650 ---- + static void + process_proto(request, proto) + http_req *request; +! const char *proto; + { +! char majorstr[16], *minorstr; + int majorint, minorint; + + if (proto == NULL) { +*************** got_proto_09: +*** 1656,1662 **** + + if (strncasecmp(proto, "HTTP/", 5) != 0) + goto bad; +! majorstr = proto + 5; + minorstr = strchr(majorstr, '.'); + if (minorstr == NULL) + goto bad; +--- 1656,1663 ---- + + if (strncasecmp(proto, "HTTP/", 5) != 0) + goto bad; +! strncpy(majorstr, proto + 5, sizeof majorstr); +! majorstr[sizeof(majorstr)-1] = 0; + minorstr = strchr(majorstr, '.'); + if (minorstr == NULL) + goto bad; +*************** bad: +*** 1695,1704 **** + * has less info per-entry). + */ + static struct content_map { +! char *name; /* postfix of file */ +! char *type; /* matching content-type */ +! char *encoding; /* matching content-encoding */ +! char *encoding11; /* matching content-encoding (HTTP/1.1) */ + } content_map[] = { + { ".html", "text/html", "", "", }, + { ".htm", "text/html", "", "", }, +--- 1696,1705 ---- + * has less info per-entry). + */ + static struct content_map { +! const char *name; /* postfix of file */ +! const char *type; /* matching content-type */ +! const char *encoding; /* matching content-encoding */ +! const char *encoding11; /* matching content-encoding (HTTP/1.1) */ + } content_map[] = { + { ".html", "text/html", "", "", }, + { ".htm", "text/html", "", "", }, +*************** static struct content_map { +*** 1821,1830 **** + /* + * given the file name, return a valid Content-Type: value. + */ +! char * + content_type(request, file) + http_req *request; +! char *file; + { + size_t len = strlen(file), nlen; + struct content_map *map; +--- 1822,1831 ---- + /* + * given the file name, return a valid Content-Type: value. + */ +! const char * + content_type(request, file) + http_req *request; +! const char *file; + { + size_t len = strlen(file), nlen; + struct content_map *map; +*************** content_type(request, file) +*** 1841,1850 **** + /* + * given the file name, return a valid Content-Encoding: value. + */ +! char * + content_encoding(request, file) + http_req *request; +! char *file; + { + size_t len = strlen(file), nlen; + struct content_map *map; +--- 1842,1851 ---- + /* + * given the file name, return a valid Content-Encoding: value. + */ +! const char * + content_encoding(request, file) + http_req *request; +! const char *file; + { + size_t len = strlen(file), nlen; + struct content_map *map; +*************** content_encoding(request, file) +*** 1864,1870 **** + */ + #ifdef DEBUG + void +! debug__(int level, char *fmt, ...) + { + va_list ap; + int savederrno; +--- 1865,1871 ---- + */ + #ifdef DEBUG + void +! debug__(int level, const char *fmt, ...) + { + va_list ap; + int savederrno; +*************** debug__(int level, char *fmt, ...) +*** 1883,1889 **** + + /* these are like warn() and err(), except for syslog not stderr */ + void +! warning(char *fmt, ...) + { + va_list ap; + +--- 1884,1890 ---- + + /* these are like warn() and err(), except for syslog not stderr */ + void +! warning(const char *fmt, ...) + { + va_list ap; + +*************** warning(char *fmt, ...) +*** 1897,1903 **** + } + + void +! error(int code, char *fmt, ...) + { + va_list ap; + +--- 1898,1904 ---- + } + + void +! error(int code, const char *fmt, ...) + { + va_list ap; + +*************** void +*** 1916,1927 **** + http_error(code, request, log) + int code; + http_req *request; +! char *log; + { + static char buf[BUFSIZ]; /* static so we don't need to malloc? */ +! char *header = http_errors_short(code); +! char *reason = http_errors_long(code); +! char *proto = (request && request->proto) ? request->proto : http_11; + int size; + + debug((DEBUG_FAT, "http_error %d: %s", code, log)); +--- 1917,1928 ---- + http_error(code, request, log) + int code; + http_req *request; +! const char *log; + { + static char buf[BUFSIZ]; /* static so we don't need to malloc? */ +! const char *header = http_errors_short(code); +! const char *reason = http_errors_long(code); +! const char *proto = (request && request->proto) ? request->proto : http_11; + int size; + + debug((DEBUG_FAT, "http_error %d: %s", code, log)); +*************** http_error(code, request, log) +*** 1960,1967 **** + /* short map between error code, and short/long messages */ + static struct errors_map { + int code; /* HTTP return code */ +! char *shortmsg; /* short version of message */ +! char *longmsg; /* long version of message */ + } errors_map[] = { + { 400, "400 Bad Request", "The request was not valid", }, + { 403, "403 Forbidden", "Access to this item has been denied", }, +--- 1961,1968 ---- + /* short map between error code, and short/long messages */ + static struct errors_map { + int code; /* HTTP return code */ +! const char *shortmsg; /* short version of message */ +! const char *longmsg; /* long version of message */ + } errors_map[] = { + { 400, "400 Bad Request", "The request was not valid", }, + { 403, "403 Forbidden", "Access to this item has been denied", }, +*************** static struct errors_map { +*** 1973,1981 **** + { 0, NULL, NULL, }, + }; + +! static char *help = "DANGER! WILL ROBINSON! DANGER!"; + +! static char * + http_errors_short(code) + int code; + { +--- 1974,1982 ---- + { 0, NULL, NULL, }, + }; + +! static const char *help = "DANGER! WILL ROBINSON! DANGER!"; + +! static const char * + http_errors_short(code) + int code; + { +*************** http_errors_short(code) +*** 1987,1993 **** + return (help); + } + +! static char * + http_errors_long(code) + int code; + { +--- 1988,1994 ---- + return (help); + } + +! static const char * + http_errors_long(code) + int code; + { +*************** http_errors_long(code) +*** 2009,2015 **** + char * + strnsep(strp, delim, lenp) + char **strp; +! char *delim; + ssize_t *lenp; + { + char *s; +--- 2010,2016 ---- + char * + strnsep(strp, delim, lenp) + char **strp; +! const char *delim; + ssize_t *lenp; + { + char *s; -- cgit v1.2.3