1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-26 09:46:09 +00:00

- Update to 2.0.50

Important changes:
  *) SECURITY: CAN-2004-0493 (cve.mitre.org)
     Close a denial of service vulnerability identified by Georgi
     Guninski which could lead to memory exhaustion with certain
     input data.  [Jeff Trawick]
  *) SECURITY: CAN-2004-0488 (cve.mitre.org)
     mod_ssl: Fix a buffer overflow in the FakeBasicAuth code for a
     (trusted) client certificate subject DN which exceeds 6K in length.
     [Joe Orton]
  Details can be found here:
        http://www.apache.org/dist/httpd/CHANGES_2.0
- Use autoconf 2.59
- Add add SUEXEC_LOGFILE tunable to set suexec logfile [1]
- Silently ignore removal of libexec/apache2 directory
- Import latest version of apr_reslit.c from apr CVS which
  adds timeout feature to apr_reslist_acquire().
  This is required for future mod_logio-st.
- Add explicit dependency on libiconv (so nowwe support libiconv)
- Move Windows Update fix from MASTER_SITE_LOCAL to ports tree
- add WITH_EXPERIMENTAL_PATCHES knobs:
  These patches are backports from apache CVS HEAD or apr CVS HEAD.
  They have positive impacts on apache responsiveness but can be
instable
  and are NOT currently supported by apache/apr teams.
  * exp-http-ready.patch: add "httpready" support for ACCEPT_FILTER
    (currently apache 2 only support "dataready")
  * exp-apr-kqueue.patch: add support for kqueue in apr_poll().
    This patch greatly improves apache network performance (up to
    18% according to the author, on my test box, between 13% and 21%)
    Test and feedback on -STABLE are welcome ;)
    For more details, please see:
    http://marc.theaimsgroup.com/?t=108650227500001&r=1&w=2

Submitted by:   knu [1]

NOTE:
Please set MASTER_SITE_APACHE_HTTPD to closest mirrors.
you can easily find them from:
http://www.apache.org/dyn/closer.cgi/httpd/
Thanks :
This commit is contained in:
Clement Laforet 2004-07-01 05:54:56 +00:00
parent 8f484b7d54
commit d84ad3cbde
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=112641
24 changed files with 3566 additions and 2228 deletions

View File

@ -8,8 +8,7 @@
#
PORTNAME= apache
PORTVERSION= 2.0.49
PORTREVISION= 3
PORTVERSION= 2.0.50
CATEGORIES= www ipv6
MASTER_SITES= ${MASTER_SITE_APACHE_HTTPD} \
http://sheepkiller.nerim.net/ports/${PORTNAME}/:powerlogo
@ -33,10 +32,12 @@ CONFLICTS= apache+mod_ssl-1.* apache+mod_ssl+ipv6-1.* apache+mod_ssl+modsnmp-1.*
ru-apache+mod_ssl-1.* ru-apache-1.* thttpd-2.*
# patch files
PATCH_SITES+= ${MASTER_SITE_LOCAL:S/$/:clement/}
PATCH_SITE_SUBDIR= clement/:clement
.if defined (WITH_WINDOWSUPDATEFIX)
PATCHFILES+= httpd-${PORTVERSION}-windowsupdate.patch:clement
EXTRA_PATCHES+= ${FILESDIR}/exp-windowsupdate.patch
.endif
.if defined(WITH_EXPERIMENTAL_PATCHES)
EXTRA_PATCHES+= ${FILESDIR}/exp-apr-kqueue.patch \
${FILESDIR}/exp-http-ready.patch
.endif
SCRIPTS_ENV+= LIBTOOL=${LIBTOOL} LIBTOOLIZE=${LIBTOOLIZE} \
@ -44,7 +45,8 @@ SCRIPTS_ENV+= LIBTOOL=${LIBTOOL} LIBTOOLIZE=${LIBTOOLIZE} \
LIBTOOL_M4=${LOCALBASE}/share/aclocal/libtool${LIBTOOL_VERSION}.m4 \
AUTOHEADER=${AUTOHEADER}
USE_AUTOCONF_VER= 257
USE_ICONV= yes
USE_AUTOCONF_VER= 259
USE_LIBTOOL_VER= 15
USE_PERL5= yes
USE_RC_SUBR= yes
@ -56,6 +58,7 @@ CONFIGURE_ARGS= --prefix=${PREFIX_RELDEST} \
--with-perl=${PERL5} \
--with-port=${WITH_HTTP_PORT} \
--with-expat=${LOCALBASE} \
--with-iconv=${LOCALBASE} \
--libdir=${PREFIX_RELDEST}/lib/apache2 \
--includedir=${PREFIX_RELDEST}/include/apache2
@ -69,7 +72,7 @@ RC_SCRIPTS_SUB= PREFIX=${PREFIX} RC_SUBR=${RC_SUBR}
MAKE_ENV+= DESTDIR=${DESTDIR} EXPR_COMPAT=yes
WITH_MPM?= prefork # or worker, perchild
WITH_MPM?= prefork # or worker, perchild, threadpool
WITH_HTTP_PORT?= 80

View File

@ -51,6 +51,7 @@
## SUEXEC_DOCROOT: SuExec root directory
## SUEXEC_USERDIR: User subdirectory (default public_html)
## SUEXEC_SAFEPATH: Set the safepath
## SUEXEC_LOGFILE: Set log file for suexec (default: /var/log/httpd-suexec.log)
## SUEXEC_UIDMIN: Minimal allowed UID (default 1000)
## SUEXEC_GIDMIN: Minimal allowed GID (default 1000)
## SUEXEC_CALLER: User allowed to call SuExec (default

View File

@ -195,6 +195,7 @@ CONFIGURE_ARGS+= --with-ssl=${OPENSSLBASE}
SUEXEC_DOCROOT?= ${PREFIX_RELDEST}/www/data
SUEXEC_USERDIR?= public_html
SUEXEC_SAFEPATH?= ${PREFIX_RELDEST}/bin:${LOCALBASE}/bin:/usr/bin:/bin
SUEXEC_LOGFILE?= /var/log/httpd-suexec.log
SUEXEC_UIDMIN?= 1000
SUEXEC_GIDMIN?= 1000
SUEXEC_CALLER?= ${WWWOWN}
@ -205,7 +206,7 @@ CONFIGURE_ARGS+= --with-suexec-caller=${SUEXEC_CALLER} \
--with-suexec-userdir="${SUEXEC_USERDIR}" \
--with-suexec-docroot="${SUEXEC_DOCROOT}" \
--with-suexec-safepath="${SUEXEC_SAFEPATH}" \
--with-suexec-logfile="/var/log/httpd-suexec.log" \
--with-suexec-logfile="${SUEXEC_LOGFILE}" \
--with-suexec-bin="${PREFIX_RELDEST}/sbin/suexec"
. if defined(WITH_SUEXEC_UMASK)
CONFIGURE_ARGS+= --with-suexec-umask=${WITH_SUEXEC_UMASK}

View File

@ -1,6 +1,4 @@
MD5 (apache2/httpd-2.0.49.tar.gz) = 275d3d37eed1b070f333d3618f7d1954
SIZE (apache2/httpd-2.0.49.tar.gz) = 5919279
MD5 (apache2/httpd-2.0.50.tar.gz) = 8b251767212aebf41a13128bb70c0b41
SIZE (apache2/httpd-2.0.50.tar.gz) = 6338536
MD5 (apache2/powerlogo.gif) = 0f106073b3c7844cf22d4df126b27c62
SIZE (apache2/powerlogo.gif) = 5279
MD5 (apache2/httpd-2.0.49-windowsupdate.patch) = a96fe94b28094483a112705d0428e6f5
SIZE (apache2/httpd-2.0.49-windowsupdate.patch) = 464

View File

@ -0,0 +1,475 @@
diff -Nursrclib/apr/configure.in srclib/apr/configure.in
--- srclib/apr/configure.in Thu May 27 21:12:47 2004
+++ srclib/apr/configure.in Wed Jun 23 16:02:02 2004
@@ -596,6 +596,25 @@
AC_CHECK_FUNCS(poll)
+# Checks for the FreeBSD KQueue and Linux epoll interfaces:
+AC_CHECK_FUNC(kevent,
+ [AC_DEFINE([HAVE_KQUEUE], 1, [Define if the KQueue interface is supported])])
+
+# epoll* may be available in libc but return ENOSYS on a pre-2.6 kernel.
+AC_CACHE_CHECK([for epoll support], [apr_cv_epoll],
+[AC_TRY_RUN([
+#include <sys/epoll.h>
+#include <unistd.h>
+
+int main()
+{
+ return epoll_create(5) == -1;
+}], [apr_cv_epoll=yes], [apr_cv_epoll=no], [apr_cv_epoll=no])])
+
+if test "$apr_cv_epoll" = "yes"; then
+ AC_DEFINE([HAVE_EPOLL], 1, [Define if the epoll interface is supported])
+fi
+
dnl ----------------------------- Checking for missing POSIX thread functions
AC_CHECK_FUNCS([getpwnam_r getpwuid_r getgrnam_r getgrgid_r])
diff -Nursrclib/apr/poll/unix/poll.c srclib/apr/poll/unix/poll.c
--- srclib/apr/poll/unix/poll.c Sat Apr 10 21:29:52 2004
+++ srclib/apr/poll/unix/poll.c Wed Jun 23 16:05:58 2004
@@ -29,11 +29,77 @@
#include <alloca.h>
#endif
+#ifdef HAVE_KQUEUE
+#include <sys/types.h>
+#include <sys/event.h>
+#include <sys/time.h>
+#endif
+
+#ifdef HAVE_EPOLL
+#include <sys/epoll.h>
+#endif
+
#ifdef NETWARE
#define HAS_SOCKETS(dt) (dt == APR_POLL_SOCKET) ? 1 : 0
#define HAS_PIPES(dt) (dt == APR_POLL_FILE) ? 1 : 0
#endif
+#ifdef HAVE_KQUEUE
+static apr_int16_t get_kqueue_revent(apr_int16_t event, apr_int16_t flags)
+ {
+ apr_int16_t rv = 0;
+
+ if (event & EVFILT_READ)
+ rv |= APR_POLLIN;
+ if (event & EVFILT_WRITE)
+ rv |= APR_POLLOUT;
+ if (flags & EV_ERROR || flags & EV_EOF)
+ rv |= APR_POLLERR;
+
+ return rv;
+}
+#endif
+
+#ifdef HAVE_EPOLL
+static apr_int16_t get_epoll_event(apr_int16_t event)
+{
+ apr_int16_t rv = 0;
+
+ if (event & APR_POLLIN)
+ rv |= EPOLLIN;
+ if (event & APR_POLLPRI)
+ rv |= EPOLLPRI;
+ if (event & APR_POLLOUT)
+ rv |= EPOLLOUT;
+ if (event & APR_POLLERR)
+ rv |= EPOLLERR;
+ if (event & APR_POLLHUP)
+ rv |= EPOLLHUP;
+ /* APR_POLLNVAL is not handled by epoll. */
+
+ return rv;
+}
+
+static apr_int16_t get_epoll_revent(apr_int16_t event)
+{
+ apr_int16_t rv = 0;
+
+ if (event & EPOLLIN)
+ rv |= APR_POLLIN;
+ if (event & EPOLLPRI)
+ rv |= APR_POLLPRI;
+ if (event & EPOLLOUT)
+ rv |= APR_POLLOUT;
+ if (event & EPOLLERR)
+ rv |= APR_POLLERR;
+ if (event & EPOLLHUP)
+ rv |= APR_POLLHUP;
+ /* APR_POLLNVAL is not handled by epoll. */
+
+ return rv;
+}
+#endif
+
#ifdef HAVE_POLL /* We can just use poll to do our socket polling. */
static apr_int16_t get_event(apr_int16_t event)
@@ -288,7 +354,14 @@
struct apr_pollset_t {
apr_uint32_t nelts;
apr_uint32_t nalloc;
-#ifdef HAVE_POLL
+#ifdef HAVE_KQUEUE
+ int kqueue_fd;
+ struct kevent kevent;
+ struct kevent *ke_set;
+#elif defined(HAVE_EPOLL)
+ int epoll_fd;
+ struct epoll_event *pollset;
+#elif defined(HAVE_POLL)
struct pollfd *pollset;
#else
fd_set readset, writeset, exceptset;
@@ -302,12 +375,21 @@
#endif
};
+#if defined(HAVE_KQUEUE) || defined(HAVE_EPOLL)
+static apr_status_t backend_cleanup(void *p_)
+{
+ apr_pollset_t *pollset = (apr_pollset_t *)p_;
+ return apr_pollset_destroy(pollset);
+
+}
+#endif
+
APR_DECLARE(apr_status_t) apr_pollset_create(apr_pollset_t **pollset,
apr_uint32_t size,
apr_pool_t *p,
apr_uint32_t flags)
{
-#if !defined(HAVE_POLL) && defined(FD_SETSIZE)
+#if !defined(HAVE_KQUEUE) && !defined(HAVE_EPOLL) && !defined(HAVE_POLL) && defined(FD_SETSIZE)
if (size > FD_SETSIZE) {
*pollset = NULL;
return APR_EINVAL;
@@ -316,7 +398,21 @@
*pollset = apr_palloc(p, sizeof(**pollset));
(*pollset)->nelts = 0;
(*pollset)->nalloc = size;
-#ifdef HAVE_POLL
+#ifdef HAVE_KQUEUE
+ (*pollset)->ke_set = (struct kevent*)apr_palloc(p, size * sizeof(struct kevent));
+ memset((*pollset)->ke_set, 0, size * sizeof(struct kevent));
+ (*pollset)->kqueue_fd = kqueue();
+ if ((*pollset)->kqueue_fd == -1) {
+ return APR_ENOMEM;
+ }
+ apr_pool_cleanup_register(p, (void*)(*pollset), backend_cleanup,
+ apr_pool_cleanup_null);
+#elif defined(HAVE_EPOLL)
+ (*pollset)->epoll_fd = epoll_create(size);
+ (*pollset)->pollset = apr_palloc(p, size * sizeof(struct epoll_event));
+ apr_pool_cleanup_register(p, (void*)(*pollset), backend_cleanup,
+ apr_pool_cleanup_null);
+#elif defined(HAVE_POLL)
(*pollset)->pollset = apr_palloc(p, size * sizeof(struct pollfd));
#else
FD_ZERO(&((*pollset)->readset));
@@ -335,25 +431,76 @@
APR_DECLARE(apr_status_t) apr_pollset_destroy(apr_pollset_t *pollset)
{
- /* A no-op function for now. If we later implement /dev/poll
- * support, we'll need to close the /dev/poll fd here
- */
+#ifdef HAVE_KQUEUE
+ close(pollset->kqueue_fd);
+#elif defined(HAVE_EPOLL)
+ close(pollset->epoll_fd);
+#endif
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_pollset_add(apr_pollset_t *pollset,
const apr_pollfd_t *descriptor)
{
-#ifndef HAVE_POLL
+#ifdef HAVE_KQUEUE
+ apr_os_sock_t fd;
+#elif defined(HAVE_EPOLL)
+ struct epoll_event ev;
+ int ret = -1;
+#else
+#if !defined(HAVE_POLL)
apr_os_sock_t fd;
#endif
+#endif
if (pollset->nelts == pollset->nalloc) {
return APR_ENOMEM;
}
pollset->query_set[pollset->nelts] = *descriptor;
-#ifdef HAVE_POLL
+
+#ifdef HAVE_KQUEUE
+ if (descriptor->desc_type == APR_POLL_SOCKET) {
+ fd = descriptor->desc.s->socketdes;
+ }
+ else {
+ fd = descriptor->desc.f->filedes;
+ }
+
+ if (descriptor->reqevents & APR_POLLIN) {
+ EV_SET(&pollset->kevent, fd, EVFILT_READ, EV_ADD, 0, 0, NULL);
+
+ if (kevent(pollset->kqueue_fd, &pollset->kevent, 1, NULL, 0,
+ NULL) == -1) {
+ return APR_ENOMEM;
+ }
+ }
+
+ if (descriptor->reqevents & APR_POLLOUT) {
+ EV_SET(&pollset->kevent, fd, EVFILT_WRITE, EV_ADD, 0, 0, NULL);
+
+ if (kevent(pollset->kqueue_fd, &pollset->kevent, 1, NULL, 0,
+ NULL) == -1) {
+ return APR_ENOMEM;
+ }
+ }
+
+#elif defined(HAVE_EPOLL)
+ ev.events = get_epoll_event(descriptor->reqevents);
+ if (descriptor->desc_type == APR_POLL_SOCKET) {
+ ev.data.fd = descriptor->desc.s->socketdes;
+ ret = epoll_ctl(pollset->epoll_fd, EPOLL_CTL_ADD,
+ descriptor->desc.s->socketdes, &ev);
+ }
+ else {
+ ev.data.fd = descriptor->desc.f->filedes;
+ ret = epoll_ctl(pollset->epoll_fd, EPOLL_CTL_ADD,
+ descriptor->desc.f->filedes, &ev);
+ }
+ if (0 != ret) {
+ return APR_EBADF;
+ }
+#elif defined(HAVE_POLL)
if (descriptor->desc_type == APR_POLL_SOCKET) {
pollset->pollset[pollset->nelts].fd = descriptor->desc.s->socketdes;
@@ -422,11 +569,97 @@
const apr_pollfd_t *descriptor)
{
apr_uint32_t i;
-#ifndef HAVE_POLL
+#ifdef HAVE_KQUEUE
+ apr_os_sock_t fd;
+#elif defined(HAVE_EPOLL)
+ struct epoll_event ev;
+ int ret = -1;
+#elif defined(HAVE_POLL)
apr_os_sock_t fd;
#endif
-#ifdef HAVE_POLL
+#ifdef HAVE_KQUEUE
+ for (i = 0; i < pollset->nelts; i++) {
+ if (descriptor->desc.s == pollset->query_set[i].desc.s) {
+ /* Found an instance of the fd: remove this and any other copies */
+ apr_uint32_t dst = i;
+ apr_uint32_t old_nelts = pollset->nelts;
+ pollset->nelts--;
+ for (i++; i < old_nelts; i++) {
+ if (descriptor->desc.s == pollset->query_set[i].desc.s) {
+ pollset->nelts--;
+ }
+ else {
+ pollset->query_set[dst] = pollset->query_set[i];
+ dst++;
+ }
+ }
+
+ if (descriptor->desc_type == APR_POLL_SOCKET) {
+ fd = descriptor->desc.s->socketdes;
+ }
+ else {
+ fd = descriptor->desc.f->filedes;
+ }
+
+ if (descriptor->reqevents & APR_POLLIN) {
+ EV_SET(&pollset->kevent, fd,
+ EVFILT_READ, EV_DELETE, 0, 0, NULL);
+
+ if (kevent(pollset->kqueue_fd, &pollset->kevent, 1, NULL, 0,
+ NULL) == -1) {
+ return APR_EBADF;
+ }
+ }
+
+ if (descriptor->reqevents & APR_POLLOUT) {
+ EV_SET(&pollset->kevent, fd,
+ EVFILT_WRITE, EV_DELETE, 0, 0, NULL);
+
+ if (kevent(pollset->kqueue_fd, &pollset->kevent, 1, NULL, 0,
+ NULL) == -1) {
+ return APR_EBADF;
+ }
+ }
+
+ return APR_SUCCESS;
+ }
+ }
+#elif defined(HAVE_EPOLL)
+ for (i = 0; i < pollset->nelts; i++) {
+ if (descriptor->desc.s == pollset->query_set[i].desc.s) {
+ /* Found an instance of the fd: remove this and any other copies */
+ apr_uint32_t dst = i;
+ apr_uint32_t old_nelts = pollset->nelts;
+ pollset->nelts--;
+ for (i++; i < old_nelts; i++) {
+ if (descriptor->desc.s == pollset->query_set[i].desc.s) {
+ pollset->nelts--;
+ }
+ else {
+ pollset->query_set[dst] = pollset->query_set[i];
+ dst++;
+ }
+ }
+ ev.events = get_epoll_event(descriptor->reqevents);
+ if (descriptor->desc_type == APR_POLL_SOCKET) {
+ ev.data.fd = descriptor->desc.s->socketdes;
+ ret = epoll_ctl(pollset->epoll_fd, EPOLL_CTL_DEL,
+ descriptor->desc.s->socketdes, &ev);
+ }
+ else {
+ ev.data.fd = descriptor->desc.f->filedes;
+ ret = epoll_ctl(pollset->epoll_fd, EPOLL_CTL_DEL,
+ descriptor->desc.f->filedes, &ev);
+ }
+ if (ret < 0) {
+ return APR_EBADF;
+ }
+
+ return APR_SUCCESS;
+ }
+ }
+#elif defined(HAVE_POLL)
for (i = 0; i < pollset->nelts; i++) {
if (descriptor->desc.s == pollset->query_set[i].desc.s) {
/* Found an instance of the fd: remove this and any other copies */
@@ -487,8 +720,119 @@
return APR_NOTFOUND;
}
+#ifdef HAVE_KQUEUE
+APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset,
+ apr_interval_time_t timeout,
+ apr_int32_t *num,
+ const apr_pollfd_t **descriptors)
+{
+ int rv;
+ apr_uint32_t i, j, r = 0;
+ struct timespec tv, *tvptr;
+
+ if (timeout < 0) {
+ tvptr = NULL;
+ }
+ else {
+ tv.tv_sec = (long)apr_time_sec(timeout);
+ tv.tv_nsec = (long)apr_time_msec(timeout);
+ tvptr = &tv;
+ }
-#ifdef HAVE_POLL
+ rv = kevent(pollset->kqueue_fd, NULL, 0, pollset->ke_set, pollset->nelts,
+ tvptr);
+ (*num) = rv;
+ if (rv < 0) {
+ return apr_get_netos_error();
+ }
+ if (rv == 0) {
+ return APR_TIMEUP;
+ }
+
+ /* TODO: Is there a better way to re-associate our data? */
+ for (i = 0; i < pollset->nelts; i++) {
+ apr_os_sock_t fd;
+ if (pollset->query_set[i].desc_type == APR_POLL_SOCKET) {
+ fd = pollset->query_set[i].desc.s->socketdes;
+ }
+ else {
+ fd = pollset->query_set[i].desc.f->filedes;
+ }
+ for (j = 0; j < rv; j++) {
+ if (pollset->ke_set[j].ident == fd ) {
+ pollset->result_set[r] = pollset->query_set[i];
+ pollset->result_set[r].rtnevents =
+ get_kqueue_revent(pollset->ke_set[j].filter,
+ pollset->ke_set[j].flags);
+ r++;
+ }
+ }
+ }
+
+ (*num) = r;
+
+ if (descriptors) {
+ *descriptors = pollset->result_set;
+ }
+
+ return APR_SUCCESS;
+}
+
+#elif defined(HAVE_EPOLL)
+
+APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset,
+ apr_interval_time_t timeout,
+ apr_int32_t *num,
+ const apr_pollfd_t **descriptors)
+{
+ int rv;
+ apr_uint32_t i, j, k;
+
+ if (timeout > 0) {
+ timeout /= 1000;
+ }
+
+ rv = epoll_wait(pollset->epoll_fd, pollset->pollset, pollset->nelts,
+ timeout);
+ (*num) = rv;
+ if (rv < 0) {
+ return apr_get_netos_error();
+ }
+ if (rv == 0) {
+ return APR_TIMEUP;
+ }
+ j = 0;
+ for (i = 0; i < pollset->nelts; i++) {
+ if (pollset->pollset[i].events != 0) {
+ /* TODO: Is there a better way to re-associate our data? */
+ for (k = 0; k < pollset->nelts; k++) {
+ if (pollset->query_set[k].desc_type == APR_POLL_SOCKET &&
+ pollset->query_set[k].desc.s->socketdes ==
+ pollset->pollset[i].data.fd) {
+ pollset->result_set[j] = pollset->query_set[k];
+ pollset->result_set[j].rtnevents =
+ get_epoll_revent(pollset->pollset[i].events);
+ j++;
+ break;
+ }
+ else if (pollset->query_set[k].desc_type == APR_POLL_FILE
+ && pollset->query_set[k].desc.f->filedes ==
+ pollset->pollset[i].data.fd) {
+ pollset->result_set[j] = pollset->query_set[k];
+ pollset->result_set[j].rtnevents =
+ get_epoll_revent(pollset->pollset[i].events);
+ j++;
+ break;
+ }
+ }
+ }
+ }
+ if (descriptors) {
+ *descriptors = pollset->result_set;
+ }
+ return APR_SUCCESS;
+}
+#elif defined(HAVE_POLL)
APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset,
apr_interval_time_t timeout,
apr_int32_t *num,

View File

@ -0,0 +1,21 @@
Index: server/listen.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/listen.c,v
retrieving revision 1.95
diff -u -r1.95 listen.c
--- server/listen.c 1 Jan 2004 13:26:23 -0000 1.95
+++ server/listen.c 3 Feb 2004 17:34:08 -0000
@@ -199,7 +199,13 @@
#if APR_HAS_SO_ACCEPTFILTER
#ifndef ACCEPT_FILTER_NAME
+#define ACCEPT_FILTER_NAME "httpready"
+#ifdef __FreeBSD_version
+#if __FreeBSD_version < 411000 /* httpready broken before 4.1.1 */
+#undef ACCEPT_FILTER_NAME
#define ACCEPT_FILTER_NAME "dataready"
+#endif
+#endif
#endif
apr_socket_accept_filter(s, ACCEPT_FILTER_NAME, "");
#endif

View File

@ -0,0 +1,11 @@
--- server/protocol.c.orig Tue Jun 29 08:21:28 2004
+++ server/protocol.c Tue Jun 29 08:21:50 2004
@@ -1248,7 +1248,7 @@
* We can only set a C-L in the response header if we haven't already
* sent any buckets on to the next output filter for this request.
*/
- if (ctx->data_sent == 0 && eos) {
+ if (ctx->data_sent == 0 && eos && !r->header_only) {
ap_set_content_length(r, r->bytes_sent);
}

View File

@ -1,39 +0,0 @@
===================================================================
RCS file: /home/cvspublic/modules/ssl/ssl_engine_kernel.c,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -r1.105 -r1.106
--- modules/ssl/ssl_engine_kernel.c 2004/03/05 02:44:40 1.105
+++ modules/ssl/ssl_engine_kernel.c 2004/05/25 12:09:01 1.106
@@ -807,7 +807,6 @@
SSLConnRec *sslconn = myConnConfig(r->connection);
SSLSrvConfigRec *sc = mySrvConfig(r->server);
SSLDirConfigRec *dc = myDirConfig(r);
- char buf1[MAX_STRING_LEN], buf2[MAX_STRING_LEN];
char *clientdn;
const char *auth_line, *username, *password;
@@ -886,14 +885,16 @@
* adding the string "xxj31ZMTZzkVA" as the password in the user file.
* This is just the crypted variant of the word "password" ;-)
*/
- apr_snprintf(buf1, sizeof(buf1), "%s:password", clientdn);
- ssl_util_uuencode(buf2, buf1, FALSE);
-
- apr_snprintf(buf1, sizeof(buf1), "Basic %s", buf2);
- apr_table_set(r->headers_in, "Authorization", buf1);
+ auth_line = apr_pstrcat(r->pool, "Basic ",
+ ap_pbase64encode(r->pool,
+ apr_pstrcat(r->pool, clientdn,
+ ":password", NULL)),
+ NULL);
+ apr_table_set(r->headers_in, "Authorization", auth_line);
ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server,
- "Faking HTTP Basic Auth header: \"Authorization: %s\"", buf1);
+ "Faking HTTP Basic Auth header: \"Authorization: %s\"",
+ auth_line);
return DECLINED;
}

View File

@ -1,32 +0,0 @@
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/protocol.c,v
retrieving revision 1.121.2.18
retrieving revision 1.121.2.19
diff -u -r1.121.2.18 -r1.121.2.19
--- server/protocol.c 2004/06/11 20:46:41 1.121.2.18
+++ server/protocol.c 2004/06/28 23:57:14 1.121.2.19
@@ -719,6 +719,23 @@
* continuations that span many many lines.
*/
apr_size_t fold_len = last_len + len + 1; /* trailing null */
+
+ if ((fold_len - 1) > r->server->limit_req_fieldsize) {
+ r->status = HTTP_BAD_REQUEST;
+ /* report what we have accumulated so far before the
+ * overflow (last_field) as the field with the problem
+ */
+ apr_table_setn(r->notes, "error-notes",
+ apr_pstrcat(r->pool,
+ "Size of a request header field "
+ "after folding "
+ "exceeds server limit.<br />\n"
+ "<pre>\n",
+ ap_escape_html(r->pool, last_field),
+ "</pre>\n", NULL));
+ return;
+ }
+
if (fold_len > alloc_len) {
char *fold_buf;
alloc_len += alloc_len;

View File

@ -0,0 +1,112 @@
--- srclib/apr-util/misc/apr_reslist.c.orig Fri Feb 13 04:52:43 2004
+++ srclib/apr-util/misc/apr_reslist.c Mon Mar 15 08:21:26 2004
@@ -49,6 +49,7 @@
int smax; /* soft maximum on the total number of resources */
int hmax; /* hard maximum on the total number of resources */
apr_interval_time_t ttl; /* TTL when we have too many resources */
+ apr_interval_time_t timeout; /* Timeout for waiting on resource */
apr_reslist_constructor constructor;
apr_reslist_destructor destructor;
void *params; /* opaque data passed to constructor and destructor calls */
@@ -118,12 +119,9 @@
res = apr_pcalloc(reslist->pool, sizeof(*res));
rv = reslist->constructor(&res->opaque, reslist->params, reslist->pool);
- if (rv != APR_SUCCESS) {
- return rv;
- }
*ret_res = res;
- return APR_SUCCESS;
+ return rv;
}
/**
@@ -132,14 +130,7 @@
*/
static apr_status_t destroy_resource(apr_reslist_t *reslist, apr_res_t *res)
{
- apr_status_t rv;
-
- rv = reslist->destructor(res->opaque, reslist->params, reslist->pool);
- if (rv != APR_SUCCESS) {
- return rv;
- }
-
- return APR_SUCCESS;
+ return reslist->destructor(res->opaque, reslist->params, reslist->pool);
}
static apr_status_t reslist_cleanup(void *data_)
@@ -187,6 +178,7 @@
/* Create the resource */
rv = create_resource(reslist, &res);
if (rv != APR_SUCCESS) {
+ free_container(reslist, res);
apr_thread_mutex_unlock(reslist->listlock);
return rv;
}
@@ -313,7 +305,15 @@
* a new one, or something becomes free. */
else while (reslist->ntotal >= reslist->hmax
&& reslist->nidle <= 0) {
- apr_thread_cond_wait(reslist->avail, reslist->listlock);
+ if (reslist->timeout) {
+ if ((rv = apr_thread_cond_timedwait(reslist->avail,
+ reslist->listlock, reslist->timeout)) != APR_SUCCESS) {
+ apr_thread_mutex_unlock(reslist->listlock);
+ return rv;
+ }
+ }
+ else
+ apr_thread_cond_wait(reslist->avail, reslist->listlock);
}
/* If we popped out of the loop, first try to see if there
* are new resources available for immediate use. */
@@ -329,17 +329,13 @@
* a resource to fill the slot and use it. */
else {
rv = create_resource(reslist, &res);
-
- if (rv != APR_SUCCESS) {
- apr_thread_mutex_unlock(reslist->listlock);
- return rv;
+ if (rv == APR_SUCCESS) {
+ reslist->ntotal++;
+ *resource = res->opaque;
}
-
- reslist->ntotal++;
- *resource = res->opaque;
free_container(reslist, res);
apr_thread_mutex_unlock(reslist->listlock);
- return APR_SUCCESS;
+ return rv;
}
}
@@ -356,6 +352,23 @@
apr_thread_mutex_unlock(reslist->listlock);
return reslist_maint(reslist);
+}
+
+APU_DECLARE(void) apr_reslist_timeout_set(apr_reslist_t *reslist,
+ apr_interval_time_t timeout)
+{
+ reslist->timeout = timeout;
+}
+
+APU_DECLARE(apr_status_t) apr_reslist_invalidate(apr_reslist_t *reslist,
+ void *resource)
+{
+ apr_status_t ret;
+ apr_thread_mutex_lock(reslist->listlock);
+ ret = reslist->destructor(resource, reslist->params, reslist->pool);
+ reslist->ntotal--;
+ apr_thread_mutex_unlock(reslist->listlock);
+ return ret;
}
#endif /* APR_HAS_THREADS */

View File

@ -16,4 +16,3 @@ Available variables you add/set to /etc/rc.conf.
Extra flags passed to start command.
- apache2limits_args (str): Default to "-e -C daemon"
Arguments of pre-start limits run.

File diff suppressed because it is too large Load Diff

View File

@ -8,8 +8,7 @@
#
PORTNAME= apache
PORTVERSION= 2.0.49
PORTREVISION= 3
PORTVERSION= 2.0.50
CATEGORIES= www ipv6
MASTER_SITES= ${MASTER_SITE_APACHE_HTTPD} \
http://sheepkiller.nerim.net/ports/${PORTNAME}/:powerlogo
@ -33,10 +32,12 @@ CONFLICTS= apache+mod_ssl-1.* apache+mod_ssl+ipv6-1.* apache+mod_ssl+modsnmp-1.*
ru-apache+mod_ssl-1.* ru-apache-1.* thttpd-2.*
# patch files
PATCH_SITES+= ${MASTER_SITE_LOCAL:S/$/:clement/}
PATCH_SITE_SUBDIR= clement/:clement
.if defined (WITH_WINDOWSUPDATEFIX)
PATCHFILES+= httpd-${PORTVERSION}-windowsupdate.patch:clement
EXTRA_PATCHES+= ${FILESDIR}/exp-windowsupdate.patch
.endif
.if defined(WITH_EXPERIMENTAL_PATCHES)
EXTRA_PATCHES+= ${FILESDIR}/exp-apr-kqueue.patch \
${FILESDIR}/exp-http-ready.patch
.endif
SCRIPTS_ENV+= LIBTOOL=${LIBTOOL} LIBTOOLIZE=${LIBTOOLIZE} \
@ -44,7 +45,8 @@ SCRIPTS_ENV+= LIBTOOL=${LIBTOOL} LIBTOOLIZE=${LIBTOOLIZE} \
LIBTOOL_M4=${LOCALBASE}/share/aclocal/libtool${LIBTOOL_VERSION}.m4 \
AUTOHEADER=${AUTOHEADER}
USE_AUTOCONF_VER= 257
USE_ICONV= yes
USE_AUTOCONF_VER= 259
USE_LIBTOOL_VER= 15
USE_PERL5= yes
USE_RC_SUBR= yes
@ -56,6 +58,7 @@ CONFIGURE_ARGS= --prefix=${PREFIX_RELDEST} \
--with-perl=${PERL5} \
--with-port=${WITH_HTTP_PORT} \
--with-expat=${LOCALBASE} \
--with-iconv=${LOCALBASE} \
--libdir=${PREFIX_RELDEST}/lib/apache2 \
--includedir=${PREFIX_RELDEST}/include/apache2
@ -69,7 +72,7 @@ RC_SCRIPTS_SUB= PREFIX=${PREFIX} RC_SUBR=${RC_SUBR}
MAKE_ENV+= DESTDIR=${DESTDIR} EXPR_COMPAT=yes
WITH_MPM?= prefork # or worker, perchild
WITH_MPM?= prefork # or worker, perchild, threadpool
WITH_HTTP_PORT?= 80

View File

@ -51,6 +51,7 @@
## SUEXEC_DOCROOT: SuExec root directory
## SUEXEC_USERDIR: User subdirectory (default public_html)
## SUEXEC_SAFEPATH: Set the safepath
## SUEXEC_LOGFILE: Set log file for suexec (default: /var/log/httpd-suexec.log)
## SUEXEC_UIDMIN: Minimal allowed UID (default 1000)
## SUEXEC_GIDMIN: Minimal allowed GID (default 1000)
## SUEXEC_CALLER: User allowed to call SuExec (default

View File

@ -195,6 +195,7 @@ CONFIGURE_ARGS+= --with-ssl=${OPENSSLBASE}
SUEXEC_DOCROOT?= ${PREFIX_RELDEST}/www/data
SUEXEC_USERDIR?= public_html
SUEXEC_SAFEPATH?= ${PREFIX_RELDEST}/bin:${LOCALBASE}/bin:/usr/bin:/bin
SUEXEC_LOGFILE?= /var/log/httpd-suexec.log
SUEXEC_UIDMIN?= 1000
SUEXEC_GIDMIN?= 1000
SUEXEC_CALLER?= ${WWWOWN}
@ -205,7 +206,7 @@ CONFIGURE_ARGS+= --with-suexec-caller=${SUEXEC_CALLER} \
--with-suexec-userdir="${SUEXEC_USERDIR}" \
--with-suexec-docroot="${SUEXEC_DOCROOT}" \
--with-suexec-safepath="${SUEXEC_SAFEPATH}" \
--with-suexec-logfile="/var/log/httpd-suexec.log" \
--with-suexec-logfile="${SUEXEC_LOGFILE}" \
--with-suexec-bin="${PREFIX_RELDEST}/sbin/suexec"
. if defined(WITH_SUEXEC_UMASK)
CONFIGURE_ARGS+= --with-suexec-umask=${WITH_SUEXEC_UMASK}

View File

@ -1,6 +1,4 @@
MD5 (apache2/httpd-2.0.49.tar.gz) = 275d3d37eed1b070f333d3618f7d1954
SIZE (apache2/httpd-2.0.49.tar.gz) = 5919279
MD5 (apache2/httpd-2.0.50.tar.gz) = 8b251767212aebf41a13128bb70c0b41
SIZE (apache2/httpd-2.0.50.tar.gz) = 6338536
MD5 (apache2/powerlogo.gif) = 0f106073b3c7844cf22d4df126b27c62
SIZE (apache2/powerlogo.gif) = 5279
MD5 (apache2/httpd-2.0.49-windowsupdate.patch) = a96fe94b28094483a112705d0428e6f5
SIZE (apache2/httpd-2.0.49-windowsupdate.patch) = 464

View File

@ -0,0 +1,475 @@
diff -Nursrclib/apr/configure.in srclib/apr/configure.in
--- srclib/apr/configure.in Thu May 27 21:12:47 2004
+++ srclib/apr/configure.in Wed Jun 23 16:02:02 2004
@@ -596,6 +596,25 @@
AC_CHECK_FUNCS(poll)
+# Checks for the FreeBSD KQueue and Linux epoll interfaces:
+AC_CHECK_FUNC(kevent,
+ [AC_DEFINE([HAVE_KQUEUE], 1, [Define if the KQueue interface is supported])])
+
+# epoll* may be available in libc but return ENOSYS on a pre-2.6 kernel.
+AC_CACHE_CHECK([for epoll support], [apr_cv_epoll],
+[AC_TRY_RUN([
+#include <sys/epoll.h>
+#include <unistd.h>
+
+int main()
+{
+ return epoll_create(5) == -1;
+}], [apr_cv_epoll=yes], [apr_cv_epoll=no], [apr_cv_epoll=no])])
+
+if test "$apr_cv_epoll" = "yes"; then
+ AC_DEFINE([HAVE_EPOLL], 1, [Define if the epoll interface is supported])
+fi
+
dnl ----------------------------- Checking for missing POSIX thread functions
AC_CHECK_FUNCS([getpwnam_r getpwuid_r getgrnam_r getgrgid_r])
diff -Nursrclib/apr/poll/unix/poll.c srclib/apr/poll/unix/poll.c
--- srclib/apr/poll/unix/poll.c Sat Apr 10 21:29:52 2004
+++ srclib/apr/poll/unix/poll.c Wed Jun 23 16:05:58 2004
@@ -29,11 +29,77 @@
#include <alloca.h>
#endif
+#ifdef HAVE_KQUEUE
+#include <sys/types.h>
+#include <sys/event.h>
+#include <sys/time.h>
+#endif
+
+#ifdef HAVE_EPOLL
+#include <sys/epoll.h>
+#endif
+
#ifdef NETWARE
#define HAS_SOCKETS(dt) (dt == APR_POLL_SOCKET) ? 1 : 0
#define HAS_PIPES(dt) (dt == APR_POLL_FILE) ? 1 : 0
#endif
+#ifdef HAVE_KQUEUE
+static apr_int16_t get_kqueue_revent(apr_int16_t event, apr_int16_t flags)
+ {
+ apr_int16_t rv = 0;
+
+ if (event & EVFILT_READ)
+ rv |= APR_POLLIN;
+ if (event & EVFILT_WRITE)
+ rv |= APR_POLLOUT;
+ if (flags & EV_ERROR || flags & EV_EOF)
+ rv |= APR_POLLERR;
+
+ return rv;
+}
+#endif
+
+#ifdef HAVE_EPOLL
+static apr_int16_t get_epoll_event(apr_int16_t event)
+{
+ apr_int16_t rv = 0;
+
+ if (event & APR_POLLIN)
+ rv |= EPOLLIN;
+ if (event & APR_POLLPRI)
+ rv |= EPOLLPRI;
+ if (event & APR_POLLOUT)
+ rv |= EPOLLOUT;
+ if (event & APR_POLLERR)
+ rv |= EPOLLERR;
+ if (event & APR_POLLHUP)
+ rv |= EPOLLHUP;
+ /* APR_POLLNVAL is not handled by epoll. */
+
+ return rv;
+}
+
+static apr_int16_t get_epoll_revent(apr_int16_t event)
+{
+ apr_int16_t rv = 0;
+
+ if (event & EPOLLIN)
+ rv |= APR_POLLIN;
+ if (event & EPOLLPRI)
+ rv |= APR_POLLPRI;
+ if (event & EPOLLOUT)
+ rv |= APR_POLLOUT;
+ if (event & EPOLLERR)
+ rv |= APR_POLLERR;
+ if (event & EPOLLHUP)
+ rv |= APR_POLLHUP;
+ /* APR_POLLNVAL is not handled by epoll. */
+
+ return rv;
+}
+#endif
+
#ifdef HAVE_POLL /* We can just use poll to do our socket polling. */
static apr_int16_t get_event(apr_int16_t event)
@@ -288,7 +354,14 @@
struct apr_pollset_t {
apr_uint32_t nelts;
apr_uint32_t nalloc;
-#ifdef HAVE_POLL
+#ifdef HAVE_KQUEUE
+ int kqueue_fd;
+ struct kevent kevent;
+ struct kevent *ke_set;
+#elif defined(HAVE_EPOLL)
+ int epoll_fd;
+ struct epoll_event *pollset;
+#elif defined(HAVE_POLL)
struct pollfd *pollset;
#else
fd_set readset, writeset, exceptset;
@@ -302,12 +375,21 @@
#endif
};
+#if defined(HAVE_KQUEUE) || defined(HAVE_EPOLL)
+static apr_status_t backend_cleanup(void *p_)
+{
+ apr_pollset_t *pollset = (apr_pollset_t *)p_;
+ return apr_pollset_destroy(pollset);
+
+}
+#endif
+
APR_DECLARE(apr_status_t) apr_pollset_create(apr_pollset_t **pollset,
apr_uint32_t size,
apr_pool_t *p,
apr_uint32_t flags)
{
-#if !defined(HAVE_POLL) && defined(FD_SETSIZE)
+#if !defined(HAVE_KQUEUE) && !defined(HAVE_EPOLL) && !defined(HAVE_POLL) && defined(FD_SETSIZE)
if (size > FD_SETSIZE) {
*pollset = NULL;
return APR_EINVAL;
@@ -316,7 +398,21 @@
*pollset = apr_palloc(p, sizeof(**pollset));
(*pollset)->nelts = 0;
(*pollset)->nalloc = size;
-#ifdef HAVE_POLL
+#ifdef HAVE_KQUEUE
+ (*pollset)->ke_set = (struct kevent*)apr_palloc(p, size * sizeof(struct kevent));
+ memset((*pollset)->ke_set, 0, size * sizeof(struct kevent));
+ (*pollset)->kqueue_fd = kqueue();
+ if ((*pollset)->kqueue_fd == -1) {
+ return APR_ENOMEM;
+ }
+ apr_pool_cleanup_register(p, (void*)(*pollset), backend_cleanup,
+ apr_pool_cleanup_null);
+#elif defined(HAVE_EPOLL)
+ (*pollset)->epoll_fd = epoll_create(size);
+ (*pollset)->pollset = apr_palloc(p, size * sizeof(struct epoll_event));
+ apr_pool_cleanup_register(p, (void*)(*pollset), backend_cleanup,
+ apr_pool_cleanup_null);
+#elif defined(HAVE_POLL)
(*pollset)->pollset = apr_palloc(p, size * sizeof(struct pollfd));
#else
FD_ZERO(&((*pollset)->readset));
@@ -335,25 +431,76 @@
APR_DECLARE(apr_status_t) apr_pollset_destroy(apr_pollset_t *pollset)
{
- /* A no-op function for now. If we later implement /dev/poll
- * support, we'll need to close the /dev/poll fd here
- */
+#ifdef HAVE_KQUEUE
+ close(pollset->kqueue_fd);
+#elif defined(HAVE_EPOLL)
+ close(pollset->epoll_fd);
+#endif
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_pollset_add(apr_pollset_t *pollset,
const apr_pollfd_t *descriptor)
{
-#ifndef HAVE_POLL
+#ifdef HAVE_KQUEUE
+ apr_os_sock_t fd;
+#elif defined(HAVE_EPOLL)
+ struct epoll_event ev;
+ int ret = -1;
+#else
+#if !defined(HAVE_POLL)
apr_os_sock_t fd;
#endif
+#endif
if (pollset->nelts == pollset->nalloc) {
return APR_ENOMEM;
}
pollset->query_set[pollset->nelts] = *descriptor;
-#ifdef HAVE_POLL
+
+#ifdef HAVE_KQUEUE
+ if (descriptor->desc_type == APR_POLL_SOCKET) {
+ fd = descriptor->desc.s->socketdes;
+ }
+ else {
+ fd = descriptor->desc.f->filedes;
+ }
+
+ if (descriptor->reqevents & APR_POLLIN) {
+ EV_SET(&pollset->kevent, fd, EVFILT_READ, EV_ADD, 0, 0, NULL);
+
+ if (kevent(pollset->kqueue_fd, &pollset->kevent, 1, NULL, 0,
+ NULL) == -1) {
+ return APR_ENOMEM;
+ }
+ }
+
+ if (descriptor->reqevents & APR_POLLOUT) {
+ EV_SET(&pollset->kevent, fd, EVFILT_WRITE, EV_ADD, 0, 0, NULL);
+
+ if (kevent(pollset->kqueue_fd, &pollset->kevent, 1, NULL, 0,
+ NULL) == -1) {
+ return APR_ENOMEM;
+ }
+ }
+
+#elif defined(HAVE_EPOLL)
+ ev.events = get_epoll_event(descriptor->reqevents);
+ if (descriptor->desc_type == APR_POLL_SOCKET) {
+ ev.data.fd = descriptor->desc.s->socketdes;
+ ret = epoll_ctl(pollset->epoll_fd, EPOLL_CTL_ADD,
+ descriptor->desc.s->socketdes, &ev);
+ }
+ else {
+ ev.data.fd = descriptor->desc.f->filedes;
+ ret = epoll_ctl(pollset->epoll_fd, EPOLL_CTL_ADD,
+ descriptor->desc.f->filedes, &ev);
+ }
+ if (0 != ret) {
+ return APR_EBADF;
+ }
+#elif defined(HAVE_POLL)
if (descriptor->desc_type == APR_POLL_SOCKET) {
pollset->pollset[pollset->nelts].fd = descriptor->desc.s->socketdes;
@@ -422,11 +569,97 @@
const apr_pollfd_t *descriptor)
{
apr_uint32_t i;
-#ifndef HAVE_POLL
+#ifdef HAVE_KQUEUE
+ apr_os_sock_t fd;
+#elif defined(HAVE_EPOLL)
+ struct epoll_event ev;
+ int ret = -1;
+#elif defined(HAVE_POLL)
apr_os_sock_t fd;
#endif
-#ifdef HAVE_POLL
+#ifdef HAVE_KQUEUE
+ for (i = 0; i < pollset->nelts; i++) {
+ if (descriptor->desc.s == pollset->query_set[i].desc.s) {
+ /* Found an instance of the fd: remove this and any other copies */
+ apr_uint32_t dst = i;
+ apr_uint32_t old_nelts = pollset->nelts;
+ pollset->nelts--;
+ for (i++; i < old_nelts; i++) {
+ if (descriptor->desc.s == pollset->query_set[i].desc.s) {
+ pollset->nelts--;
+ }
+ else {
+ pollset->query_set[dst] = pollset->query_set[i];
+ dst++;
+ }
+ }
+
+ if (descriptor->desc_type == APR_POLL_SOCKET) {
+ fd = descriptor->desc.s->socketdes;
+ }
+ else {
+ fd = descriptor->desc.f->filedes;
+ }
+
+ if (descriptor->reqevents & APR_POLLIN) {
+ EV_SET(&pollset->kevent, fd,
+ EVFILT_READ, EV_DELETE, 0, 0, NULL);
+
+ if (kevent(pollset->kqueue_fd, &pollset->kevent, 1, NULL, 0,
+ NULL) == -1) {
+ return APR_EBADF;
+ }
+ }
+
+ if (descriptor->reqevents & APR_POLLOUT) {
+ EV_SET(&pollset->kevent, fd,
+ EVFILT_WRITE, EV_DELETE, 0, 0, NULL);
+
+ if (kevent(pollset->kqueue_fd, &pollset->kevent, 1, NULL, 0,
+ NULL) == -1) {
+ return APR_EBADF;
+ }
+ }
+
+ return APR_SUCCESS;
+ }
+ }
+#elif defined(HAVE_EPOLL)
+ for (i = 0; i < pollset->nelts; i++) {
+ if (descriptor->desc.s == pollset->query_set[i].desc.s) {
+ /* Found an instance of the fd: remove this and any other copies */
+ apr_uint32_t dst = i;
+ apr_uint32_t old_nelts = pollset->nelts;
+ pollset->nelts--;
+ for (i++; i < old_nelts; i++) {
+ if (descriptor->desc.s == pollset->query_set[i].desc.s) {
+ pollset->nelts--;
+ }
+ else {
+ pollset->query_set[dst] = pollset->query_set[i];
+ dst++;
+ }
+ }
+ ev.events = get_epoll_event(descriptor->reqevents);
+ if (descriptor->desc_type == APR_POLL_SOCKET) {
+ ev.data.fd = descriptor->desc.s->socketdes;
+ ret = epoll_ctl(pollset->epoll_fd, EPOLL_CTL_DEL,
+ descriptor->desc.s->socketdes, &ev);
+ }
+ else {
+ ev.data.fd = descriptor->desc.f->filedes;
+ ret = epoll_ctl(pollset->epoll_fd, EPOLL_CTL_DEL,
+ descriptor->desc.f->filedes, &ev);
+ }
+ if (ret < 0) {
+ return APR_EBADF;
+ }
+
+ return APR_SUCCESS;
+ }
+ }
+#elif defined(HAVE_POLL)
for (i = 0; i < pollset->nelts; i++) {
if (descriptor->desc.s == pollset->query_set[i].desc.s) {
/* Found an instance of the fd: remove this and any other copies */
@@ -487,8 +720,119 @@
return APR_NOTFOUND;
}
+#ifdef HAVE_KQUEUE
+APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset,
+ apr_interval_time_t timeout,
+ apr_int32_t *num,
+ const apr_pollfd_t **descriptors)
+{
+ int rv;
+ apr_uint32_t i, j, r = 0;
+ struct timespec tv, *tvptr;
+
+ if (timeout < 0) {
+ tvptr = NULL;
+ }
+ else {
+ tv.tv_sec = (long)apr_time_sec(timeout);
+ tv.tv_nsec = (long)apr_time_msec(timeout);
+ tvptr = &tv;
+ }
-#ifdef HAVE_POLL
+ rv = kevent(pollset->kqueue_fd, NULL, 0, pollset->ke_set, pollset->nelts,
+ tvptr);
+ (*num) = rv;
+ if (rv < 0) {
+ return apr_get_netos_error();
+ }
+ if (rv == 0) {
+ return APR_TIMEUP;
+ }
+
+ /* TODO: Is there a better way to re-associate our data? */
+ for (i = 0; i < pollset->nelts; i++) {
+ apr_os_sock_t fd;
+ if (pollset->query_set[i].desc_type == APR_POLL_SOCKET) {
+ fd = pollset->query_set[i].desc.s->socketdes;
+ }
+ else {
+ fd = pollset->query_set[i].desc.f->filedes;
+ }
+ for (j = 0; j < rv; j++) {
+ if (pollset->ke_set[j].ident == fd ) {
+ pollset->result_set[r] = pollset->query_set[i];
+ pollset->result_set[r].rtnevents =
+ get_kqueue_revent(pollset->ke_set[j].filter,
+ pollset->ke_set[j].flags);
+ r++;
+ }
+ }
+ }
+
+ (*num) = r;
+
+ if (descriptors) {
+ *descriptors = pollset->result_set;
+ }
+
+ return APR_SUCCESS;
+}
+
+#elif defined(HAVE_EPOLL)
+
+APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset,
+ apr_interval_time_t timeout,
+ apr_int32_t *num,
+ const apr_pollfd_t **descriptors)
+{
+ int rv;
+ apr_uint32_t i, j, k;
+
+ if (timeout > 0) {
+ timeout /= 1000;
+ }
+
+ rv = epoll_wait(pollset->epoll_fd, pollset->pollset, pollset->nelts,
+ timeout);
+ (*num) = rv;
+ if (rv < 0) {
+ return apr_get_netos_error();
+ }
+ if (rv == 0) {
+ return APR_TIMEUP;
+ }
+ j = 0;
+ for (i = 0; i < pollset->nelts; i++) {
+ if (pollset->pollset[i].events != 0) {
+ /* TODO: Is there a better way to re-associate our data? */
+ for (k = 0; k < pollset->nelts; k++) {
+ if (pollset->query_set[k].desc_type == APR_POLL_SOCKET &&
+ pollset->query_set[k].desc.s->socketdes ==
+ pollset->pollset[i].data.fd) {
+ pollset->result_set[j] = pollset->query_set[k];
+ pollset->result_set[j].rtnevents =
+ get_epoll_revent(pollset->pollset[i].events);
+ j++;
+ break;
+ }
+ else if (pollset->query_set[k].desc_type == APR_POLL_FILE
+ && pollset->query_set[k].desc.f->filedes ==
+ pollset->pollset[i].data.fd) {
+ pollset->result_set[j] = pollset->query_set[k];
+ pollset->result_set[j].rtnevents =
+ get_epoll_revent(pollset->pollset[i].events);
+ j++;
+ break;
+ }
+ }
+ }
+ }
+ if (descriptors) {
+ *descriptors = pollset->result_set;
+ }
+ return APR_SUCCESS;
+}
+#elif defined(HAVE_POLL)
APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset,
apr_interval_time_t timeout,
apr_int32_t *num,

View File

@ -0,0 +1,21 @@
Index: server/listen.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/listen.c,v
retrieving revision 1.95
diff -u -r1.95 listen.c
--- server/listen.c 1 Jan 2004 13:26:23 -0000 1.95
+++ server/listen.c 3 Feb 2004 17:34:08 -0000
@@ -199,7 +199,13 @@
#if APR_HAS_SO_ACCEPTFILTER
#ifndef ACCEPT_FILTER_NAME
+#define ACCEPT_FILTER_NAME "httpready"
+#ifdef __FreeBSD_version
+#if __FreeBSD_version < 411000 /* httpready broken before 4.1.1 */
+#undef ACCEPT_FILTER_NAME
#define ACCEPT_FILTER_NAME "dataready"
+#endif
+#endif
#endif
apr_socket_accept_filter(s, ACCEPT_FILTER_NAME, "");
#endif

View File

@ -0,0 +1,11 @@
--- server/protocol.c.orig Tue Jun 29 08:21:28 2004
+++ server/protocol.c Tue Jun 29 08:21:50 2004
@@ -1248,7 +1248,7 @@
* We can only set a C-L in the response header if we haven't already
* sent any buckets on to the next output filter for this request.
*/
- if (ctx->data_sent == 0 && eos) {
+ if (ctx->data_sent == 0 && eos && !r->header_only) {
ap_set_content_length(r, r->bytes_sent);
}

View File

@ -1,39 +0,0 @@
===================================================================
RCS file: /home/cvspublic/modules/ssl/ssl_engine_kernel.c,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -r1.105 -r1.106
--- modules/ssl/ssl_engine_kernel.c 2004/03/05 02:44:40 1.105
+++ modules/ssl/ssl_engine_kernel.c 2004/05/25 12:09:01 1.106
@@ -807,7 +807,6 @@
SSLConnRec *sslconn = myConnConfig(r->connection);
SSLSrvConfigRec *sc = mySrvConfig(r->server);
SSLDirConfigRec *dc = myDirConfig(r);
- char buf1[MAX_STRING_LEN], buf2[MAX_STRING_LEN];
char *clientdn;
const char *auth_line, *username, *password;
@@ -886,14 +885,16 @@
* adding the string "xxj31ZMTZzkVA" as the password in the user file.
* This is just the crypted variant of the word "password" ;-)
*/
- apr_snprintf(buf1, sizeof(buf1), "%s:password", clientdn);
- ssl_util_uuencode(buf2, buf1, FALSE);
-
- apr_snprintf(buf1, sizeof(buf1), "Basic %s", buf2);
- apr_table_set(r->headers_in, "Authorization", buf1);
+ auth_line = apr_pstrcat(r->pool, "Basic ",
+ ap_pbase64encode(r->pool,
+ apr_pstrcat(r->pool, clientdn,
+ ":password", NULL)),
+ NULL);
+ apr_table_set(r->headers_in, "Authorization", auth_line);
ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server,
- "Faking HTTP Basic Auth header: \"Authorization: %s\"", buf1);
+ "Faking HTTP Basic Auth header: \"Authorization: %s\"",
+ auth_line);
return DECLINED;
}

View File

@ -1,32 +0,0 @@
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/protocol.c,v
retrieving revision 1.121.2.18
retrieving revision 1.121.2.19
diff -u -r1.121.2.18 -r1.121.2.19
--- server/protocol.c 2004/06/11 20:46:41 1.121.2.18
+++ server/protocol.c 2004/06/28 23:57:14 1.121.2.19
@@ -719,6 +719,23 @@
* continuations that span many many lines.
*/
apr_size_t fold_len = last_len + len + 1; /* trailing null */
+
+ if ((fold_len - 1) > r->server->limit_req_fieldsize) {
+ r->status = HTTP_BAD_REQUEST;
+ /* report what we have accumulated so far before the
+ * overflow (last_field) as the field with the problem
+ */
+ apr_table_setn(r->notes, "error-notes",
+ apr_pstrcat(r->pool,
+ "Size of a request header field "
+ "after folding "
+ "exceeds server limit.<br />\n"
+ "<pre>\n",
+ ap_escape_html(r->pool, last_field),
+ "</pre>\n", NULL));
+ return;
+ }
+
if (fold_len > alloc_len) {
char *fold_buf;
alloc_len += alloc_len;

View File

@ -0,0 +1,112 @@
--- srclib/apr-util/misc/apr_reslist.c.orig Fri Feb 13 04:52:43 2004
+++ srclib/apr-util/misc/apr_reslist.c Mon Mar 15 08:21:26 2004
@@ -49,6 +49,7 @@
int smax; /* soft maximum on the total number of resources */
int hmax; /* hard maximum on the total number of resources */
apr_interval_time_t ttl; /* TTL when we have too many resources */
+ apr_interval_time_t timeout; /* Timeout for waiting on resource */
apr_reslist_constructor constructor;
apr_reslist_destructor destructor;
void *params; /* opaque data passed to constructor and destructor calls */
@@ -118,12 +119,9 @@
res = apr_pcalloc(reslist->pool, sizeof(*res));
rv = reslist->constructor(&res->opaque, reslist->params, reslist->pool);
- if (rv != APR_SUCCESS) {
- return rv;
- }
*ret_res = res;
- return APR_SUCCESS;
+ return rv;
}
/**
@@ -132,14 +130,7 @@
*/
static apr_status_t destroy_resource(apr_reslist_t *reslist, apr_res_t *res)
{
- apr_status_t rv;
-
- rv = reslist->destructor(res->opaque, reslist->params, reslist->pool);
- if (rv != APR_SUCCESS) {
- return rv;
- }
-
- return APR_SUCCESS;
+ return reslist->destructor(res->opaque, reslist->params, reslist->pool);
}
static apr_status_t reslist_cleanup(void *data_)
@@ -187,6 +178,7 @@
/* Create the resource */
rv = create_resource(reslist, &res);
if (rv != APR_SUCCESS) {
+ free_container(reslist, res);
apr_thread_mutex_unlock(reslist->listlock);
return rv;
}
@@ -313,7 +305,15 @@
* a new one, or something becomes free. */
else while (reslist->ntotal >= reslist->hmax
&& reslist->nidle <= 0) {
- apr_thread_cond_wait(reslist->avail, reslist->listlock);
+ if (reslist->timeout) {
+ if ((rv = apr_thread_cond_timedwait(reslist->avail,
+ reslist->listlock, reslist->timeout)) != APR_SUCCESS) {
+ apr_thread_mutex_unlock(reslist->listlock);
+ return rv;
+ }
+ }
+ else
+ apr_thread_cond_wait(reslist->avail, reslist->listlock);
}
/* If we popped out of the loop, first try to see if there
* are new resources available for immediate use. */
@@ -329,17 +329,13 @@
* a resource to fill the slot and use it. */
else {
rv = create_resource(reslist, &res);
-
- if (rv != APR_SUCCESS) {
- apr_thread_mutex_unlock(reslist->listlock);
- return rv;
+ if (rv == APR_SUCCESS) {
+ reslist->ntotal++;
+ *resource = res->opaque;
}
-
- reslist->ntotal++;
- *resource = res->opaque;
free_container(reslist, res);
apr_thread_mutex_unlock(reslist->listlock);
- return APR_SUCCESS;
+ return rv;
}
}
@@ -356,6 +352,23 @@
apr_thread_mutex_unlock(reslist->listlock);
return reslist_maint(reslist);
+}
+
+APU_DECLARE(void) apr_reslist_timeout_set(apr_reslist_t *reslist,
+ apr_interval_time_t timeout)
+{
+ reslist->timeout = timeout;
+}
+
+APU_DECLARE(apr_status_t) apr_reslist_invalidate(apr_reslist_t *reslist,
+ void *resource)
+{
+ apr_status_t ret;
+ apr_thread_mutex_lock(reslist->listlock);
+ ret = reslist->destructor(resource, reslist->params, reslist->pool);
+ reslist->ntotal--;
+ apr_thread_mutex_unlock(reslist->listlock);
+ return ret;
}
#endif /* APR_HAS_THREADS */

View File

@ -16,4 +16,3 @@ Available variables you add/set to /etc/rc.conf.
Extra flags passed to start command.
- apache2limits_args (str): Default to "-e -C daemon"
Arguments of pre-start limits run.

File diff suppressed because it is too large Load Diff