diff options
Diffstat (limited to 'libs/sgi-webuci/boa-patches')
-rw-r--r-- | libs/sgi-webuci/boa-patches/010-config.patch | 13 | ||||
-rw-r--r-- | libs/sgi-webuci/boa-patches/020-sendfile_ENOSYS.patch | 15 | ||||
-rw-r--r-- | libs/sgi-webuci/boa-patches/030-Makefile.in.patch | 13 | ||||
-rw-r--r-- | libs/sgi-webuci/boa-patches/040-allow_8bit.patch | 16 | ||||
-rw-r--r-- | libs/sgi-webuci/boa-patches/060-buffer_escape.patch | 26 | ||||
-rw-r--r-- | libs/sgi-webuci/boa-patches/100-no_tz.patch | 10 | ||||
-rw-r--r-- | libs/sgi-webuci/boa-patches/200-plugin_api.patch | 253 |
7 files changed, 225 insertions, 121 deletions
diff --git a/libs/sgi-webuci/boa-patches/010-config.patch b/libs/sgi-webuci/boa-patches/010-config.patch new file mode 100644 index 000000000..8360d14cc --- /dev/null +++ b/libs/sgi-webuci/boa-patches/010-config.patch @@ -0,0 +1,13 @@ +Index: boa-0.94.14rc21/examples/boa.conf +=================================================================== +--- boa-0.94.14rc21.orig/examples/boa.conf 2007-08-08 20:00:58.000000000 -0400 ++++ boa-0.94.14rc21/examples/boa.conf 2007-08-08 20:01:15.000000000 -0400 +@@ -232,7 +232,7 @@ + # Aliases: Aliases one path to another. + # Example: Alias /path1/bar /path2/foo + +-Alias /doc /usr/doc ++Alias /doc /usr/share/doc + + # ScriptAlias: Maps a virtual path to a directory for serving scripts + # Example: ScriptAlias /htbin/ /www/htbin/ diff --git a/libs/sgi-webuci/boa-patches/020-sendfile_ENOSYS.patch b/libs/sgi-webuci/boa-patches/020-sendfile_ENOSYS.patch new file mode 100644 index 000000000..6da0ebaa3 --- /dev/null +++ b/libs/sgi-webuci/boa-patches/020-sendfile_ENOSYS.patch @@ -0,0 +1,15 @@ +Index: boa-0.94.14rc21/src/pipe.c +=================================================================== +--- boa-0.94.14rc21.orig/src/pipe.c 2007-08-08 20:03:29.000000000 -0400 ++++ boa-0.94.14rc21/src/pipe.c 2007-08-08 20:03:45.000000000 -0400 +@@ -215,7 +215,9 @@ + } + req->ranges->start = sendfile_offset; + if (bytes_written < 0) { +- if (errno == EWOULDBLOCK || errno == EAGAIN) { ++ if (errno == ENOSYS) { ++ return io_shuffle(req); ++ } else if (errno == EWOULDBLOCK || errno == EAGAIN) { + return -1; /* request blocked at the pipe level, but keep going */ + } else if (errno == EINTR) { + goto retrysendfile; diff --git a/libs/sgi-webuci/boa-patches/030-Makefile.in.patch b/libs/sgi-webuci/boa-patches/030-Makefile.in.patch new file mode 100644 index 000000000..755bd5e42 --- /dev/null +++ b/libs/sgi-webuci/boa-patches/030-Makefile.in.patch @@ -0,0 +1,13 @@ +Index: boa-0.94.14rc21/Makefile.in +=================================================================== +--- boa-0.94.14rc21.orig/Makefile.in 2007-08-08 20:04:19.000000000 -0400 ++++ boa-0.94.14rc21/Makefile.in 2007-08-08 20:04:35.000000000 -0400 +@@ -20,7 +20,7 @@ + + mrclean: clean + -(cd src && $(MAKE) $(MFLAGS) mrclean) +- -(cd docs && $(MAKE)$(MFLAGS) mrclean) ++ -(cd docs && $(MAKE) $(MFLAGS) mrclean) + rm -f config.status config.cache config.h config.log + rm -f Makefile *~ + diff --git a/libs/sgi-webuci/boa-patches/040-allow_8bit.patch b/libs/sgi-webuci/boa-patches/040-allow_8bit.patch new file mode 100644 index 000000000..bec758c34 --- /dev/null +++ b/libs/sgi-webuci/boa-patches/040-allow_8bit.patch @@ -0,0 +1,16 @@ +Index: boa-0.94.14rc21/src/util.c +=================================================================== +--- boa-0.94.14rc21.orig/src/util.c 2007-08-08 20:05:06.000000000 -0400 ++++ boa-0.94.14rc21/src/util.c 2007-08-08 20:05:14.000000000 -0400 +@@ -410,11 +410,6 @@ + uri_old++; + if ((c = *uri_old++) && (d = *uri_old++)) { + *uri = HEX_TO_DECIMAL(c, d); +- if (*uri < 32 || *uri > 126) { +- /* control chars in URI */ +- *uri = '\0'; +- return 0; +- } + } else { + *uri = '\0'; + return 0; diff --git a/libs/sgi-webuci/boa-patches/060-buffer_escape.patch b/libs/sgi-webuci/boa-patches/060-buffer_escape.patch new file mode 100644 index 000000000..570c254e1 --- /dev/null +++ b/libs/sgi-webuci/boa-patches/060-buffer_escape.patch @@ -0,0 +1,26 @@ +diff --git a/src/buffer.c b/src/buffer.c +index 99f3e7c..6720e21 100644 +--- a/src/buffer.c ++++ b/src/buffer.c +@@ -77,6 +77,7 @@ int req_write_escape_http(request * req, const char *msg) + char c, *dest; + const char *inp; + ++ int skip = 0; + int left; + inp = msg; + dest = req->buffer + req->buffer_end; +@@ -84,7 +85,12 @@ int req_write_escape_http(request * req, const char *msg) + * in the middle of a transfer of up to 3 bytes */ + left = BUFFER_SIZE - req->buffer_end; + while ((c = *inp++) && left >= 3) { +- if (needs_escape((unsigned int) c)) { ++ /* Lower the skip character count. */ ++ if (skip) skip--; ++ /* If we have a '%', we skip the two follow characters. */ ++ if (c == '%') skip = 2; ++ ++ if (!skip && needs_escape((unsigned int) c)) { + *dest++ = '%'; + *dest++ = INT_TO_HEX((c >> 4) & 0xf); + *dest++ = INT_TO_HEX(c & 0xf); diff --git a/libs/sgi-webuci/boa-patches/100-no_tz.patch b/libs/sgi-webuci/boa-patches/100-no_tz.patch index 639677eed..e5dbf8edf 100644 --- a/libs/sgi-webuci/boa-patches/100-no_tz.patch +++ b/libs/sgi-webuci/boa-patches/100-no_tz.patch @@ -1,7 +1,8 @@ -diff -urN boa-0.94.13/src/util.c boa/src/util.c ---- boa-0.94.13/src/util.c 2002-07-08 01:22:18.000000000 +0200 -+++ boa/src/util.c 2008-04-25 21:56:20.000000000 +0200 -@@ -95,14 +95,9 @@ +Index: boa-0.94.14rc21/src/util.c +=================================================================== +--- boa-0.94.14rc21.orig/src/util.c 2005-02-22 15:11:29.000000000 +0100 ++++ boa-0.94.14rc21/src/util.c 2008-06-11 08:45:10.000000000 +0200 +@@ -151,14 +151,9 @@ static char buf[30]; int time_offset; @@ -19,4 +20,3 @@ diff -urN boa-0.94.13/src/util.c boa/src/util.c p = buf + 29; *p-- = '\0'; *p-- = ' '; - diff --git a/libs/sgi-webuci/boa-patches/200-plugin_api.patch b/libs/sgi-webuci/boa-patches/200-plugin_api.patch index de7999159..78933da68 100644 --- a/libs/sgi-webuci/boa-patches/200-plugin_api.patch +++ b/libs/sgi-webuci/boa-patches/200-plugin_api.patch @@ -1,7 +1,7 @@ -Index: boa-0.94.13/src/list.h +Index: boa-0.94.14rc21/src/list.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ boa-0.94.13/src/list.h 2008-05-27 19:28:21.000000000 +0200 ++++ boa-0.94.14rc21/src/list.h 2008-06-11 10:25:04.000000000 +0200 @@ -0,0 +1,601 @@ +#ifndef _LINUX_LIST_H +#define _LINUX_LIST_H @@ -604,11 +604,11 @@ Index: boa-0.94.13/src/list.h + pos = n) + +#endif -Index: boa-0.94.13/src/plugin.c +Index: boa-0.94.14rc21/src/plugin.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ boa-0.94.13/src/plugin.c 2008-05-27 19:28:21.000000000 +0200 -@@ -0,0 +1,189 @@ ++++ boa-0.94.14rc21/src/plugin.c 2008-06-11 10:25:04.000000000 +0200 +@@ -0,0 +1,198 @@ +/* + * Simple plugin API for boa + * Copyright (C) 2008 John Crispin <blogic@openwrt.org> @@ -670,7 +670,17 @@ Index: boa-0.94.13/src/plugin.c + break; + } + ctx.server_addr = req->local_ip_addr; -+ ctx.server_proto = req->http_version; ++ switch (req->http_version) { ++ case HTTP09: ++ ctx.server_proto = "HTTP/0.9"; ++ break; ++ case HTTP10: ++ ctx.server_proto = "HTTP/1.0"; ++ break; ++ case HTTP11: ++ ctx.server_proto = "HTTP/1.1"; ++ break; ++ } + ctx.query_string = req->query_string; + ctx.remote_addr = req->remote_ip_addr; + ctx.remote_port = req->remote_port; @@ -691,19 +701,19 @@ Index: boa-0.94.13/src/plugin.c + + switch(child_pid) { + case -1: -+ log_error_time(); ++ log_error_doc(req); + perror("fork"); + send_r_error(req); + return 0; + + case 0: + if (dup2(req->fd, STDOUT_FILENO) == -1) { -+ log_error_time(); ++ log_error_doc(req); + perror("dup2 - fd"); + _exit(1); + } + if (set_block_fd(req->fd) == -1) { -+ log_error_time(); ++ log_error_doc(req); + perror("cgi-fcntl"); + _exit(1); + } @@ -713,7 +723,6 @@ Index: boa-0.94.13/src/plugin.c + close(req->post_data_fd); + set_block_fd(STDIN_FILENO); + } -+ close_access_log(); + + if (cgi_log_fd) + dup2(cgi_log_fd, STDERR_FILENO); @@ -798,11 +807,11 @@ Index: boa-0.94.13/src/plugin.c +} + + -Index: boa-0.94.13/src/request.c +Index: boa-0.94.14rc21/src/request.c =================================================================== ---- boa-0.94.13.orig/src/request.c 2002-07-24 05:03:59.000000000 +0200 -+++ boa-0.94.13/src/request.c 2008-05-27 19:28:21.000000000 +0200 -@@ -50,6 +50,7 @@ +--- boa-0.94.14rc21.orig/src/request.c 2005-02-22 15:11:29.000000000 +0100 ++++ boa-0.94.14rc21/src/request.c 2008-06-11 10:25:04.000000000 +0200 +@@ -59,6 +59,7 @@ dequeue(&request_free, request_free); /* dequeue the head */ } else { req = (request *) malloc(sizeof (request)); @@ -810,105 +819,116 @@ Index: boa-0.94.13/src/request.c if (!req) { log_error_time(); perror("malloc for new request"); -@@ -603,6 +604,8 @@ +@@ -793,6 +794,8 @@ int process_header_end(request * req) { + int ret; + if (!req->logline) { - send_r_error(req); - return 0; -@@ -630,11 +633,26 @@ + log_error_doc(req); + fputs("No logline in process_header_end\n", stderr); +@@ -855,19 +858,35 @@ } if (req->method == M_POST) { - req->post_data_fd = create_temporary_file(1, NULL, 0); -- if (req->post_data_fd == 0) -- return(0); -- return(1); /* success */ -- } -+ if (!req->plugin) { -+ req->post_data_fd = create_temporary_file(1, NULL, 0); -+ } else { -+ int fd[2]; -+ if (pipe(&fd[0]) != -1) { -+ req->post_data_fd = fd[1]; -+ req->read_data_fd = fd[0]; -+ set_nonblock_fd(req->post_data_fd); -+ } -+ } -+ if (req->post_data_fd == 0) { -+ return(0); -+ } -+ if (!req->plugin) -+ return(1); /* success */ ++ if (!req->plugin) { ++ req->post_data_fd = create_temporary_file(1, NULL, 0); ++ } else { ++ int fd[2]; ++ if (pipe(&fd[0]) != -1) { ++ req->post_data_fd = fd[1]; ++ req->read_data_fd = fd[0]; ++ set_nonblock_fd(req->post_data_fd); ++ } ++ } + if (req->post_data_fd == 0) { + /* errors already logged */ + send_r_error(req); + return 0; + } +- if (fcntl(req->post_data_fd, F_SETFD, 1) == -1) { +- boa_perror(req, "unable to set close-on-exec for req->post_data_fd!"); +- close(req->post_data_fd); +- req->post_data_fd = 0; +- return 0; ++ if (!req->plugin) { ++ if (fcntl(req->post_data_fd, F_SETFD, 1) == -1) { ++ boa_perror(req, "unable to set close-on-exec for req->post_data_fd!"); ++ close(req->post_data_fd); ++ req->post_data_fd = 0; ++ return 0; ++ } ++ return(1); /* success */ + } +- return 1; /* success */ + } + -+ ret = plugin_handle(req); -+ if (ret) -+ return ret; ++ ret = plugin_handle(req); ++ if (ret) { ++ return ret; + } - if (req->is_cgi) { - return init_cgi(req); -Index: boa-0.94.13/src/Makefile.in + if (req->cgi_type) { +Index: boa-0.94.14rc21/src/Makefile.in =================================================================== ---- boa-0.94.13.orig/src/Makefile.in 2002-03-24 23:20:19.000000000 +0100 -+++ boa-0.94.13/src/Makefile.in 2008-05-27 19:28:21.000000000 +0200 -@@ -20,7 +20,7 @@ +--- boa-0.94.14rc21.orig/src/Makefile.in 2005-02-22 04:02:40.000000000 +0100 ++++ boa-0.94.14rc21/src/Makefile.in 2008-06-11 10:25:04.000000000 +0200 +@@ -15,7 +15,7 @@ srcdir = @srcdir@ VPATH = @srcdir@:@srcdir@/../extras LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ +LIBS = @LIBS@ -ldl - CFLAGS = @CFLAGS@ -I. - - # Change these if necessary -@@ -32,7 +32,8 @@ - + CFLAGS = @CFLAGS@ + CPPFLAGS = @CPPFLAGS@ -I@srcdir@ -I. + @ifGNUmake@DEPEND = .depend +@@ -26,6 +26,7 @@ SOURCES = alias.c boa.c buffer.c cgi.c cgi_header.c config.c escape.c \ - get.c hash.c ip.c log.c mmap_cache.c pipe.c queue.c read.c \ -- request.c response.c select.c signals.c util.c sublog.c -+ request.c response.c select.c signals.c util.c sublog.c \ -+ plugin.c - - OBJS = y.tab.o lex.yy.o $(SOURCES:.c=.o) timestamp.o @STRUTIL@ + get.c hash.c ip.c log.c mmap_cache.c pipe.c queue.c range.c \ + read.c request.c response.c signals.c util.c sublog.c \ ++ plugin.c \ + @ASYNCIO_SOURCE@ @ACCESSCONTROL_SOURCE@ -Index: boa-0.94.13/src/boa.h + OBJS = $(SOURCES:.c=.o) timestamp.o @STRUTIL@ +Index: boa-0.94.14rc21/src/boa.h =================================================================== ---- boa-0.94.13.orig/src/boa.h 2002-07-26 05:03:44.000000000 +0200 -+++ boa-0.94.13/src/boa.h 2008-05-27 19:28:21.000000000 +0200 -@@ -37,6 +37,7 @@ +--- boa-0.94.14rc21.orig/src/boa.h 2005-02-22 15:11:29.000000000 +0100 ++++ boa-0.94.14rc21/src/boa.h 2008-06-11 10:25:04.000000000 +0200 +@@ -38,6 +38,7 @@ #include <fcntl.h> #include <limits.h> /* OPEN_MAX */ #include <setjmp.h> +#include <stdbool.h> - #include <netdb.h> #include <netinet/in.h> -@@ -50,6 +51,7 @@ + +@@ -49,6 +50,7 @@ #include "compat.h" /* oh what fun is porting */ #include "defines.h" #include "globals.h" +#include "boa-plugin.h" /* alias */ - void add_alias(char *fakename, char *realname, int script); -@@ -192,4 +194,9 @@ - /* select */ - void select_loop(int server_s); - + void add_alias(const char *fakename, const char *realname, enum ALIAS type); +@@ -225,5 +227,10 @@ + void range_pool_push(Range * r); + int ranges_fixup(request * req); + int range_parse(request * req, const char *str); +- ++ +/* plugins */ +int plugin_init(char *path); +int plugin_handle(request * req); +struct httpd_plugin *plugin_lookup(request *req); + #endif -Index: boa-0.94.13/src/config.c +Index: boa-0.94.14rc21/src/config.c =================================================================== ---- boa-0.94.13.orig/src/config.c 2002-07-26 05:04:29.000000000 +0200 -+++ boa-0.94.13/src/config.c 2008-05-27 19:28:21.000000000 +0200 -@@ -61,6 +61,7 @@ +--- boa-0.94.14rc21.orig/src/config.c 2005-02-22 15:11:29.000000000 +0100 ++++ boa-0.94.14rc21/src/config.c 2008-06-11 10:25:04.000000000 +0200 +@@ -64,6 +64,7 @@ char *error_log_name; char *access_log_name; char *cgi_log_name; @@ -916,17 +936,17 @@ Index: boa-0.94.13/src/config.c int use_localtime; -@@ -116,6 +117,7 @@ - {"SinglePostLimit", S1A, c_set_int, &single_post_limit}, - {"CGIPath", S1A, c_set_string, &cgi_path}, - {"MaxConnections", S1A, c_set_int, &max_connections}, +@@ -165,6 +166,7 @@ + {"CGINice", S2A, c_set_int, &cgi_nice}, + #endif + {"CGIEnv", S2A, c_add_cgi_env, NULL}, + {"PluginRoot", S1A, c_set_string, &plugin_root}, }; - static void c_set_user(char *v1, char *v2, void *t) -@@ -323,6 +325,22 @@ - free(dirmaker); - dirmaker = temp; + static void c_add_cgi_env(char *v1, char *v2, void *t) +@@ -544,6 +546,22 @@ + single_post_limit); + exit(EXIT_FAILURE); } + if (plugin_root) { + char *plugin_path = plugin_root; @@ -939,69 +959,70 @@ Index: boa-0.94.13/src/config.c + next++; + } + -+ plugin_init(normalize_path(plugin_path)); ++ plugin_init(plugin_path); + plugin_path = next; + } while (plugin_path); + free(plugin_root); + } - #if 0 - if (mime_types) { -Index: boa-0.94.13/src/alias.c + if (vhost_root && virtualhost) { + fprintf(stderr, "Both VHostRoot and VirtualHost were enabled, and " +Index: boa-0.94.14rc21/src/alias.c =================================================================== ---- boa-0.94.13.orig/src/alias.c 2002-07-28 04:46:52.000000000 +0200 -+++ boa-0.94.13/src/alias.c 2008-05-27 19:28:21.000000000 +0200 -@@ -213,6 +213,7 @@ - uri_len = strlen(req->request_uri); +--- boa-0.94.14rc21.orig/src/alias.c 2005-02-22 15:11:29.000000000 +0100 ++++ boa-0.94.14rc21/src/alias.c 2008-06-11 10:25:04.000000000 +0200 +@@ -246,6 +246,7 @@ + uri_len = strlen(req->request_uri); current = find_alias(req->request_uri, uri_len); + req->plugin = !!plugin_lookup(req); if (current) { - if (current->type == SCRIPTALIAS) /* Script */ -@@ -237,7 +238,7 @@ - } + return init_script_alias(req, current, uri_len); +@@ -263,7 +264,7 @@ + uri_len - current->fake_len + 1); if (current->type == REDIRECT) { /* Redirect */ - if (req->method == M_POST) { /* POST to non-script */ + if ((req->method == M_POST) && !req->plugin) { /* POST to non-script */ /* it's not a cgi, but we try to POST??? */ - send_r_bad_request(req); - return 0; /* not a script alias, therefore begin filling in data */ -@@ -361,7 +362,7 @@ + log_error_doc(req); + fputs("POST to non-script is disallowed.\n", stderr); +@@ -432,7 +433,7 @@ else - req->is_cgi = CGI; + req->cgi_type = CGI; return 1; - } else if (req->method == M_POST) { /* POST to non-script */ + } else if ((req->method == M_POST) && !req->plugin) { /* POST to non-script */ /* it's not a cgi, but we try to POST??? */ - send_r_bad_request(req); - return 0; -Index: boa-0.94.13/src/globals.h + log_error_doc(req); + fputs("POST to non-script disallowed.\n", stderr); +Index: boa-0.94.14rc21/src/globals.h =================================================================== ---- boa-0.94.13.orig/src/globals.h 2002-07-24 05:03:59.000000000 +0200 -+++ boa-0.94.13/src/globals.h 2008-05-27 19:28:21.000000000 +0200 -@@ -47,6 +47,7 @@ - struct request { /* pending requests */ - int fd; /* client's socket fd */ - int status; /* see #defines.h */ -+ bool plugin; - time_t time_last; /* time of last succ. op. */ - char *pathname; /* pathname of requested file */ - int simple; /* simple request? */ -@@ -92,6 +93,7 @@ - char *header_referer; +--- boa-0.94.14rc21.orig/src/globals.h 2005-02-22 15:11:29.000000000 +0100 ++++ boa-0.94.14rc21/src/globals.h 2008-06-11 10:25:04.000000000 +0200 +@@ -158,6 +158,7 @@ + char *host; /* what we end up using for 'host', no matter the contents of header_host */ int post_data_fd; /* fd for post data tmpfile */ + int read_data_fd; /* fd for post data input (plugin) */ char *path_info; /* env variable */ char *path_translated; /* env variable */ -Index: boa-0.94.13/src/read.c +@@ -193,6 +194,8 @@ + char accept[MAX_ACCEPT_LENGTH]; /* Accept: fields */ + #endif + ++ bool plugin; ++ + struct request *next; /* next */ + struct request *prev; /* previous */ + }; +Index: boa-0.94.14rc21/src/read.c =================================================================== ---- boa-0.94.13.orig/src/read.c 2002-03-18 02:53:48.000000000 +0100 -+++ boa-0.94.13/src/read.c 2008-05-27 19:28:21.000000000 +0200 -@@ -338,8 +338,11 @@ +--- boa-0.94.14rc21.orig/src/read.c 2005-02-23 16:41:55.000000000 +0100 ++++ boa-0.94.14rc21/src/read.c 2008-06-11 10:25:04.000000000 +0200 +@@ -375,8 +375,11 @@ if (bytes_to_write == 0) { /* nothing left in buffer to write */ req->header_line = req->header_end = req->buffer; @@ -1015,10 +1036,10 @@ Index: boa-0.94.13/src/read.c /* if here, we can safely assume that there is more to read */ req->status = BODY_READ; return 1; -Index: boa-0.94.13/src/boa-plugin.h +Index: boa-0.94.14rc21/src/boa-plugin.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ boa-0.94.13/src/boa-plugin.h 2008-05-27 19:28:21.000000000 +0200 ++++ boa-0.94.14rc21/src/boa-plugin.h 2008-06-11 10:25:04.000000000 +0200 @@ -0,0 +1,67 @@ +#ifndef _HTTPD_PLUGIN_H__ +#define _HTTPD_PLUGIN_H__ |