Import of pkgsrc-2014Q1

This commit is contained in:
2014-04-17 16:38:45 +02:00
parent 785076ae39
commit 9a8c06dafb
19365 changed files with 828089 additions and 278039 deletions

View File

@@ -1,6 +1,6 @@
# $NetBSD: Makefile,v 1.89.2.1 2013/07/15 20:19:16 spz Exp $
# $NetBSD: Makefile,v 1.100 2014/03/28 11:25:43 adam Exp $
DISTNAME= httpd-2.2.25
DISTNAME= httpd-2.2.27
PKGNAME= ${DISTNAME:S/httpd/apache/}
CATEGORIES= www
MASTER_SITES= ${MASTER_SITE_APACHE:=httpd/} \
@@ -8,7 +8,7 @@ MASTER_SITES= ${MASTER_SITE_APACHE:=httpd/} \
http://archive.eu.apache.org/dist/httpd/
EXTRACT_SUFX= .tar.bz2
MAINTAINER= tron@NetBSD.org
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= http://httpd.apache.org/
COMMENT= Apache HTTP (Web) server, version 2.2
LICENSE= apache-2.0
@@ -227,9 +227,9 @@ post-install:
${CHMOD} ${BINMODE} ${DESTDIR}${PREFIX}/sbin/$$file; \
done
${CHOWN} -h -R ${BINOWN}:${BINGRP} ${DESTDIR}${PREFIX}/share/httpd
${CHOWN} -h -R ${BINOWN}:${BINGRP} ${DESTDIR}${PREFIX}/include/httpd
${CHOWN} -h -R ${BINOWN}:${BINGRP} ${DESTDIR}${PREFIX}/lib/httpd
${CHOWN} -RP ${BINOWN}:${BINGRP} ${DESTDIR}${PREFIX}/share/httpd
${CHOWN} -RP ${BINOWN}:${BINGRP} ${DESTDIR}${PREFIX}/include/httpd
${CHOWN} -RP ${BINOWN}:${BINGRP} ${DESTDIR}${PREFIX}/lib/httpd
${CHOWN} ${BINOWN}:${BINGRP} ${DESTDIR}${PREFIX}/libexec/cgi-bin/test-cgi
${CHOWN} ${BINOWN}:${BINGRP} ${DESTDIR}${PREFIX}/libexec/cgi-bin/printenv

View File

@@ -1,4 +1,4 @@
@comment $NetBSD: PLIST,v 1.22 2013/03/03 20:05:03 tron Exp $
@comment $NetBSD: PLIST,v 1.24 2014/03/28 11:25:43 adam Exp $
include/httpd/ap_compat.h
include/httpd/ap_config.h
include/httpd/ap_config_auto.h
@@ -170,7 +170,6 @@ share/examples/httpd/extra/httpd-vhosts.conf
share/examples/httpd/httpd.conf
share/examples/httpd/magic
share/examples/httpd/mime.types
share/examples/rc.d/apache
share/httpd/build/config.nice
share/httpd/build/config_vars.mk
share/httpd/build/instdso.sh
@@ -463,14 +462,14 @@ share/httpd/manual/developer/debugging.html
share/httpd/manual/developer/debugging.html.en
share/httpd/manual/developer/documenting.html
share/httpd/manual/developer/documenting.html.en
share/httpd/manual/developer/documenting.html.zh-cn
share/httpd/manual/developer/documenting.html.zh-cn.utf8
share/httpd/manual/developer/filters.html
share/httpd/manual/developer/filters.html.en
share/httpd/manual/developer/hooks.html
share/httpd/manual/developer/hooks.html.en
share/httpd/manual/developer/index.html
share/httpd/manual/developer/index.html.en
share/httpd/manual/developer/index.html.zh-cn
share/httpd/manual/developer/index.html.zh-cn.utf8
share/httpd/manual/developer/modules.html
share/httpd/manual/developer/modules.html.en
share/httpd/manual/developer/modules.html.ja.utf8
@@ -496,7 +495,7 @@ share/httpd/manual/env.html.tr.utf8
share/httpd/manual/faq/index.html
share/httpd/manual/faq/index.html.en
share/httpd/manual/faq/index.html.tr.utf8
share/httpd/manual/faq/index.html.zh-cn
share/httpd/manual/faq/index.html.zh-cn.utf8
share/httpd/manual/filter.html
share/httpd/manual/filter.html.en
share/httpd/manual/filter.html.es
@@ -520,7 +519,7 @@ share/httpd/manual/handler.html.ja.utf8
share/httpd/manual/handler.html.ko.euc-kr
share/httpd/manual/handler.html.ru.koi8-r
share/httpd/manual/handler.html.tr.utf8
share/httpd/manual/handler.html.zh-cn
share/httpd/manual/handler.html.zh-cn.utf8
share/httpd/manual/howto/access.html
share/httpd/manual/howto/access.html.en
share/httpd/manual/howto/auth.html
@@ -543,7 +542,7 @@ share/httpd/manual/howto/index.html
share/httpd/manual/howto/index.html.en
share/httpd/manual/howto/index.html.ja.utf8
share/httpd/manual/howto/index.html.ko.euc-kr
share/httpd/manual/howto/index.html.zh-cn
share/httpd/manual/howto/index.html.zh-cn.utf8
share/httpd/manual/howto/public_html.html
share/httpd/manual/howto/public_html.html.en
share/httpd/manual/howto/public_html.html.ja.utf8
@@ -571,6 +570,7 @@ share/httpd/manual/images/mod_filter_new.gif
share/httpd/manual/images/mod_filter_new.png
share/httpd/manual/images/mod_filter_new.tr.png
share/httpd/manual/images/mod_filter_old.gif
share/httpd/manual/images/mod_filter_old.png
share/httpd/manual/images/mod_rewrite_fig1.gif
share/httpd/manual/images/mod_rewrite_fig1.png
share/httpd/manual/images/mod_rewrite_fig2.gif
@@ -598,7 +598,7 @@ share/httpd/manual/index.html.ja.utf8
share/httpd/manual/index.html.ko.euc-kr
share/httpd/manual/index.html.pt-br
share/httpd/manual/index.html.tr.utf8
share/httpd/manual/index.html.zh-cn
share/httpd/manual/index.html.zh-cn.utf8
share/httpd/manual/install.html
share/httpd/manual/install.html.de
share/httpd/manual/install.html.en
@@ -628,7 +628,7 @@ share/httpd/manual/misc/index.html
share/httpd/manual/misc/index.html.en
share/httpd/manual/misc/index.html.ko.euc-kr
share/httpd/manual/misc/index.html.tr.utf8
share/httpd/manual/misc/index.html.zh-cn
share/httpd/manual/misc/index.html.zh-cn.utf8
share/httpd/manual/misc/password_encryptions.html
share/httpd/manual/misc/password_encryptions.html.en
share/httpd/manual/misc/perf-tuning.html
@@ -669,7 +669,7 @@ share/httpd/manual/mod/directives.html.ja.utf8
share/httpd/manual/mod/directives.html.ko.euc-kr
share/httpd/manual/mod/directives.html.ru.koi8-r
share/httpd/manual/mod/directives.html.tr.utf8
share/httpd/manual/mod/directives.html.zh-cn
share/httpd/manual/mod/directives.html.zh-cn.utf8
share/httpd/manual/mod/event.html
share/httpd/manual/mod/event.html.en
share/httpd/manual/mod/index.html
@@ -679,7 +679,7 @@ share/httpd/manual/mod/index.html.es
share/httpd/manual/mod/index.html.ja.utf8
share/httpd/manual/mod/index.html.ko.euc-kr
share/httpd/manual/mod/index.html.tr.utf8
share/httpd/manual/mod/index.html.zh-cn
share/httpd/manual/mod/index.html.zh-cn.utf8
share/httpd/manual/mod/mod_actions.html
share/httpd/manual/mod/mod_actions.html.de
share/httpd/manual/mod/mod_actions.html.en
@@ -987,7 +987,7 @@ share/httpd/manual/mod/quickreference.html.ja.utf8
share/httpd/manual/mod/quickreference.html.ko.euc-kr
share/httpd/manual/mod/quickreference.html.ru.koi8-r
share/httpd/manual/mod/quickreference.html.tr.utf8
share/httpd/manual/mod/quickreference.html.zh-cn
share/httpd/manual/mod/quickreference.html.zh-cn.utf8
share/httpd/manual/mod/worker.html
share/httpd/manual/mod/worker.html.de
share/httpd/manual/mod/worker.html.en
@@ -1001,7 +1001,7 @@ share/httpd/manual/mpm.html.fr
share/httpd/manual/mpm.html.ja.utf8
share/httpd/manual/mpm.html.ko.euc-kr
share/httpd/manual/mpm.html.tr.utf8
share/httpd/manual/mpm.html.zh-cn
share/httpd/manual/mpm.html.zh-cn.utf8
share/httpd/manual/new_features_2_0.html
share/httpd/manual/new_features_2_0.html.de
share/httpd/manual/new_features_2_0.html.en
@@ -1024,7 +1024,7 @@ share/httpd/manual/platform/ebcdic.html.ko.euc-kr
share/httpd/manual/platform/index.html
share/httpd/manual/platform/index.html.en
share/httpd/manual/platform/index.html.ko.euc-kr
share/httpd/manual/platform/index.html.zh-cn
share/httpd/manual/platform/index.html.zh-cn.utf8
share/httpd/manual/platform/netware.html
share/httpd/manual/platform/netware.html.en
share/httpd/manual/platform/netware.html.ko.euc-kr
@@ -1086,7 +1086,7 @@ share/httpd/manual/programs/index.html.ja.utf8
share/httpd/manual/programs/index.html.ko.euc-kr
share/httpd/manual/programs/index.html.ru.koi8-r
share/httpd/manual/programs/index.html.tr.utf8
share/httpd/manual/programs/index.html.zh-cn
share/httpd/manual/programs/index.html.zh-cn.utf8
share/httpd/manual/programs/logresolve.html
share/httpd/manual/programs/logresolve.html.en
share/httpd/manual/programs/logresolve.html.ko.euc-kr
@@ -1118,7 +1118,7 @@ share/httpd/manual/rewrite/index.html
share/httpd/manual/rewrite/index.html.en
share/httpd/manual/rewrite/index.html.fr
share/httpd/manual/rewrite/index.html.tr.utf8
share/httpd/manual/rewrite/index.html.zh-cn
share/httpd/manual/rewrite/index.html.zh-cn.utf8
share/httpd/manual/rewrite/intro.html
share/httpd/manual/rewrite/intro.html.en
share/httpd/manual/rewrite/intro.html.fr
@@ -1151,12 +1151,12 @@ share/httpd/manual/sitemap.html.es
share/httpd/manual/sitemap.html.ja.utf8
share/httpd/manual/sitemap.html.ko.euc-kr
share/httpd/manual/sitemap.html.tr.utf8
share/httpd/manual/sitemap.html.zh-cn
share/httpd/manual/sitemap.html.zh-cn.utf8
share/httpd/manual/ssl/index.html
share/httpd/manual/ssl/index.html.en
share/httpd/manual/ssl/index.html.ja.utf8
share/httpd/manual/ssl/index.html.tr.utf8
share/httpd/manual/ssl/index.html.zh-cn
share/httpd/manual/ssl/index.html.zh-cn.utf8
share/httpd/manual/ssl/ssl_compat.html
share/httpd/manual/ssl/ssl_compat.html.en
share/httpd/manual/ssl/ssl_faq.html
@@ -1188,7 +1188,9 @@ share/httpd/manual/style/lang.dtd
share/httpd/manual/style/latex/atbeginend.sty
share/httpd/manual/style/manualpage.dtd
share/httpd/manual/style/modulesynopsis.dtd
share/httpd/manual/style/scripts/MINIFY
share/httpd/manual/style/scripts/prettify.js
share/httpd/manual/style/scripts/prettify.min.js
share/httpd/manual/style/sitemap.dtd
share/httpd/manual/style/version.ent
share/httpd/manual/suexec.html
@@ -1232,7 +1234,7 @@ share/httpd/manual/vhosts/index.html.ja.utf8
share/httpd/manual/vhosts/index.html.ko.euc-kr
share/httpd/manual/vhosts/index.html.ru.koi8-r
share/httpd/manual/vhosts/index.html.tr.utf8
share/httpd/manual/vhosts/index.html.zh-cn
share/httpd/manual/vhosts/index.html.zh-cn.utf8
share/httpd/manual/vhosts/ip-based.html
share/httpd/manual/vhosts/ip-based.html.en
share/httpd/manual/vhosts/ip-based.html.fr

View File

@@ -1,4 +1,4 @@
# $NetBSD: buildlink3.mk,v 1.15 2013/02/20 12:14:43 fhajny Exp $
# $NetBSD: buildlink3.mk,v 1.17 2014/02/12 23:18:43 tron Exp $
BUILDLINK_TREE+= apache
@@ -6,7 +6,7 @@ BUILDLINK_TREE+= apache
APACHE_BUILDLINK3_MK:=
BUILDLINK_API_DEPENDS.apache+= apache>=2.2.3<2.3
BUILDLINK_ABI_DEPENDS.apache+= apache>=2.2.23nb4
BUILDLINK_ABI_DEPENDS.apache+= apache>=2.2.25nb3
BUILDLINK_PKGSRCDIR.apache?= ../../www/apache22
BUILDLINK_DEPMETHOD.apache?= build
.if defined(APACHE_MODULE)

View File

@@ -1,8 +1,8 @@
$NetBSD: distinfo,v 1.55.2.1 2013/07/15 20:19:16 spz Exp $
$NetBSD: distinfo,v 1.59 2014/03/28 11:25:43 adam Exp $
SHA1 (httpd-2.2.25.tar.bz2) = e34222d1a8de38825397a1c70949bcc5836a1236
RMD160 (httpd-2.2.25.tar.bz2) = 8a7745a5f6acb84adaac5cbd94f0e842c3cd7edc
Size (httpd-2.2.25.tar.bz2) = 5524905 bytes
SHA1 (httpd-2.2.27.tar.bz2) = fd4bf18dd1b3e0d9be9e85ff7e033b2eb8aa4976
RMD160 (httpd-2.2.27.tar.bz2) = bda89eb8d39c73ace7a0de6804b8831cab9e2476
Size (httpd-2.2.27.tar.bz2) = 5616798 bytes
SHA1 (patch-aa) = e0bfdf6bc9cb034bea46a390a12a5508e363c9a7
SHA1 (patch-ab) = 365cc3b0ac2d9d68ccb94f5699fe168a1c9b0150
SHA1 (patch-ac) = 515043b5c215d49fe8f6d3191b502c978e2a2dad
@@ -15,5 +15,5 @@ SHA1 (patch-am) = ab4a2f7e5a1a3064e908b61157e7fd349c0b0c08
SHA1 (patch-aw) = ca53d67beeb2c2c4d9adb04d3d79e24a8c427fd4
SHA1 (patch-docs_man_apxs.8) = 70797ea73ae6379492971bec1106a8427ae7fdaa
SHA1 (patch-lock.c) = 770ca03f1cb4421879bd5baa5a7c30cc91acb6e1
SHA1 (patch-modules_ssl_ssl__engine__kernel.c) = fd6f425d18231f0daca9fc2553638891a7241a4a
SHA1 (patch-modules_proxy_mod_proxy_connect.c) = b2b5d0242a92c7bf20b14c16d8cd3abae42f3746
SHA1 (patch-repos.c) = 0e0361b91d4b0fe6c7c55a12fdfd2e6aacc710e1

View File

@@ -0,0 +1,38 @@
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='@SMF_NAME@'>
<service name='@SMF_PREFIX@/@SMF_NAME@' type='service' version='0'>
<create_default_instance enabled="false" />
<single_instance />
<dependency name='network' grouping='require_all' restart_on='error' type='service'>
<service_fmri value='svc:/milestone/network:default' />
</dependency>
<dependency name='filesystem-local' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/filesystem/local:default' />
</dependency>
<dependency name='config-file' grouping='require_all' restart_on='refresh' type='path'>
<service_fmri value='file://localhost@PKG_SYSCONFDIR@/httpd.conf'/>
</dependency>
<method_context>
<method_environment>
<envvar name="LD_PRELOAD_32" value="/usr/lib/extendedFILE.so.1" />
</method_environment>
</method_context>
<exec_method name='start' type='method' exec='@PREFIX@/sbin/httpd -k start' timeout_seconds='300' />
<exec_method name='stop' type='method' exec='@PREFIX@/sbin/httpd -k stop' timeout_seconds='300' />
<exec_method name='refresh' type='method' exec='@PREFIX@/sbin/httpd -k graceful' timeout_seconds='300' />
<property_group name='startd' type='framework'>
<propval name='ignore_error' type='astring' value='core,signal' />
</property_group>
<stability value='Evolving' />
<template>
<common_name>
<loctext xml:lang='C'>Apache 2 HTTP server</loctext>
</common_name>
<documentation>
<manpage title='httpd' section='8' manpath='@PREFIX@/apache2/man' />
<doc_link name='apache.org' uri='http://httpd.apache.org' />
</documentation>
</template>
</service>
</service_bundle>

View File

@@ -1,4 +1,4 @@
# $NetBSD: options.mk,v 1.9 2010/11/01 17:28:49 adam Exp $
# $NetBSD: options.mk,v 1.12 2014/02/17 17:32:55 adam Exp $
PKG_OPTIONS_VAR= PKG_OPTIONS.apache
PKG_OPTIONS_REQUIRED_GROUPS= mpm

View File

@@ -1,34 +0,0 @@
$NetBSD: patch-modules_mappers_mod_rewrite.c,v 1.3 2013/05/30 22:58:15 tron Exp $
Fix for security vulnerability reported in CVE-2013-1862. Patch taken
from here:
http://people.apache.org/~jorton/mod_rewrite-CVE-2013-1862.patch
--- modules/mappers/mod_rewrite.c.orig 2013-02-18 21:31:42.000000000 +0000
+++ modules/mappers/mod_rewrite.c 2013-05-30 23:50:27.000000000 +0100
@@ -500,11 +500,11 @@
logline = apr_psprintf(r->pool, "%s %s %s %s [%s/sid#%pp][rid#%pp/%s%s%s] "
"(%d) %s%s%s%s" APR_EOL_STR,
- rhost ? rhost : "UNKNOWN-HOST",
- rname ? rname : "-",
- r->user ? (*r->user ? r->user : "\"\"") : "-",
+ rhost ? ap_escape_logitem(r->pool, rhost) : "UNKNOWN-HOST",
+ rname ? ap_escape_logitem(r->pool, rname) : "-",
+ r->user ? (*r->user ? ap_escape_logitem(r->pool, r->user) : "\"\"") : "-",
current_logtime(r),
- ap_get_server_name(r),
+ ap_escape_logitem(r->pool, ap_get_server_name(r)),
(void *)(r->server),
(void *)r,
r->main ? "subreq" : "initial",
@@ -514,7 +514,7 @@
perdir ? "[perdir " : "",
perdir ? perdir : "",
perdir ? "] ": "",
- text);
+ ap_escape_logitem(r->pool, text));
nbytes = strlen(logline);
apr_file_write(conf->rewritelogfp, logline, &nbytes);

View File

@@ -0,0 +1,335 @@
$NetBSD: patch-modules_proxy_mod_proxy_connect.c,v 1.2 2014/02/17 17:32:56 adam Exp $
--- modules/proxy/mod_proxy_connect.c
+++ modules/proxy/mod_proxy_connect.c
@@ -21,6 +21,8 @@
#include "mod_proxy.h"
#include "apr_poll.h"
+#define CONN_BLKSZ AP_IOBUFSIZE
+
module AP_MODULE_DECLARE_DATA proxy_connect_module;
/*
@@ -71,6 +73,50 @@
return OK;
}
+/* read available data (in blocks of CONN_BLKSZ) from c_i and copy to c_o */
+static int proxy_connect_transfer(request_rec *r, conn_rec *c_i, conn_rec *c_o,
+ apr_bucket_brigade *bb, char *name)
+{
+ int rv;
+#ifdef DEBUGGING
+ apr_off_t len;
+#endif
+
+ do {
+ apr_brigade_cleanup(bb);
+ rv = ap_get_brigade(c_i->input_filters, bb, AP_MODE_READBYTES,
+ APR_NONBLOCK_READ, CONN_BLKSZ);
+ if (rv == APR_SUCCESS) {
+ if (APR_BRIGADE_EMPTY(bb))
+ break;
+#ifdef DEBUGGING
+ len = -1;
+ apr_brigade_length(bb, 0, &len);
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ "proxy: CONNECT: read %" APR_OFF_T_FMT
+ " bytes from %s", len, name);
+#endif
+ rv = ap_pass_brigade(c_o->output_filters, bb);
+ if (rv == APR_SUCCESS) {
+ ap_fflush(c_o->output_filters, bb);
+ } else {
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
+ "proxy: CONNECT: error on %s - ap_pass_brigade",
+ name);
+ }
+ } else if (!APR_STATUS_IS_EAGAIN(rv)) {
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r,
+ "proxy: CONNECT: error on %s - ap_get_brigade",
+ name);
+ }
+ } while (rv == APR_SUCCESS);
+
+ if (APR_STATUS_IS_EAGAIN(rv)) {
+ rv = APR_SUCCESS;
+ }
+ return rv;
+}
+
/* CONNECT handler */
static int proxy_connect_handler(request_rec *r, proxy_worker *worker,
proxy_server_conf *conf,
@@ -79,11 +125,15 @@
{
apr_pool_t *p = r->pool;
apr_socket_t *sock;
+ conn_rec *c = r->connection;
+ conn_rec *backconn;
+
+ apr_bucket_brigade *bb = apr_brigade_create(p, c->bucket_alloc);
apr_status_t err, rv;
apr_size_t i, o, nbytes;
char buffer[HUGE_STRING_LEN];
- apr_socket_t *client_socket = ap_get_module_config(r->connection->conn_config, &core_module);
- int failed;
+ apr_socket_t *client_socket = ap_get_module_config(c->conn_config, &core_module);
+ int failed, rc;
apr_pollset_t *pollset;
apr_pollfd_t pollfd;
const apr_pollfd_t *signalled;
@@ -158,12 +208,10 @@
case APR_URI_SNEWS_DEFAULT_PORT:
break;
default:
- /* XXX can we call ap_proxyerror() here to get a nice log message? */
- return HTTP_FORBIDDEN;
+ return ap_proxyerror(r, HTTP_FORBIDDEN, "Connect to remote machine blocked");
}
} else if(!allowed_port(conf, uri.port)) {
- /* XXX can we call ap_proxyerror() here to get a nice log message? */
- return HTTP_FORBIDDEN;
+ return ap_proxyerror(r, HTTP_FORBIDDEN, "Connect to remote machine blocked");
}
/*
@@ -205,18 +253,57 @@
}
}
+ /* setup polling for connection */
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ "proxy: CONNECT: setting up poll()");
+
+ if ((rv = apr_pollset_create(&pollset, 2, r->pool, 0)) != APR_SUCCESS) {
+ apr_socket_close(sock);
+ ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
+ "proxy: CONNECT: error apr_pollset_create()");
+ return HTTP_INTERNAL_SERVER_ERROR;
+ }
+
+ /* Add client side to the poll */
+ pollfd.p = r->pool;
+ pollfd.desc_type = APR_POLL_SOCKET;
+ pollfd.reqevents = APR_POLLIN;
+ pollfd.desc.s = client_socket;
+ pollfd.client_data = NULL;
+ apr_pollset_add(pollset, &pollfd);
+
+ /* Add the server side to the poll */
+ pollfd.desc.s = sock;
+ apr_pollset_add(pollset, &pollfd);
+
/*
* Step Three: Send the Request
*
* Send the HTTP/1.1 CONNECT request to the remote server
*/
- /* we are acting as a tunnel - the output filter stack should
- * be completely empty, because when we are done here we are done completely.
- * We add the NULL filter to the stack to do this...
- */
- r->output_filters = NULL;
- r->connection->output_filters = NULL;
+ backconn = ap_run_create_connection(c->pool, r->server, sock,
+ c->id, c->sbh, c->bucket_alloc);
+ if (!backconn) {
+ /* peer reset */
+ ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
+ "proxy: an error occurred creating a new connection "
+ "to %pI (%s)", connect_addr, connectname);
+ apr_socket_close(sock);
+ return HTTP_INTERNAL_SERVER_ERROR;
+ }
+ ap_proxy_ssl_disable(backconn);
+ rc = ap_run_pre_connection(backconn, sock);
+ if (rc != OK && rc != DONE) {
+ backconn->aborted = 1;
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ "proxy: CONNECT: pre_connection setup failed (%d)", rc);
+ return HTTP_INTERNAL_SERVER_ERROR;
+ }
+
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ "proxy: CONNECT: connection complete to %pI (%s)",
+ connect_addr, connectname);
/* If we are connecting through a remote proxy, we need to pass
@@ -227,12 +314,11 @@
*/
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"proxy: CONNECT: sending the CONNECT request to the remote proxy");
- nbytes = apr_snprintf(buffer, sizeof(buffer),
+ ap_fprintf(backconn->output_filters, bb,
"CONNECT %s HTTP/1.0" CRLF, r->uri);
- apr_socket_send(sock, buffer, &nbytes);
- nbytes = apr_snprintf(buffer, sizeof(buffer),
- "Proxy-agent: %s" CRLF CRLF, ap_get_server_banner());
- apr_socket_send(sock, buffer, &nbytes);
+ ap_fprintf(backconn->output_filters, bb,
+ "Proxy-agent: %s" CRLF CRLF, ap_get_server_version());
+ ap_fflush(backconn->output_filters, bb);
}
else {
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
@@ -240,11 +326,12 @@
nbytes = apr_snprintf(buffer, sizeof(buffer),
"HTTP/1.0 200 Connection Established" CRLF);
ap_xlate_proto_to_ascii(buffer, nbytes);
- apr_socket_send(client_socket, buffer, &nbytes);
+ ap_fwrite(c->output_filters, bb, buffer, nbytes);
nbytes = apr_snprintf(buffer, sizeof(buffer),
"Proxy-agent: %s" CRLF CRLF, ap_get_server_banner());
ap_xlate_proto_to_ascii(buffer, nbytes);
- apr_socket_send(client_socket, buffer, &nbytes);
+ ap_fwrite(c->output_filters, bb, buffer, nbytes);
+ ap_fflush(c->output_filters, bb);
#if 0
/* This is safer code, but it doesn't work yet. I'm leaving it
* here so that I can fix it later.
@@ -265,27 +352,15 @@
* Handle two way transfer of data over the socket (this is a tunnel).
*/
+ /* we are now acting as a tunnel - the input/output filter stacks should
+ * not contain any non-connection filters.
+ */
+ r->output_filters = c->output_filters;
+ r->proto_output_filters = c->output_filters;
+ r->input_filters = c->input_filters;
+ r->proto_input_filters = c->input_filters;
/* r->sent_bodyct = 1;*/
- if ((rv = apr_pollset_create(&pollset, 2, r->pool, 0)) != APR_SUCCESS) {
- apr_socket_close(sock);
- ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
- "proxy: CONNECT: error apr_pollset_create()");
- return HTTP_INTERNAL_SERVER_ERROR;
- }
-
- /* Add client side to the poll */
- pollfd.p = r->pool;
- pollfd.desc_type = APR_POLL_SOCKET;
- pollfd.reqevents = APR_POLLIN;
- pollfd.desc.s = client_socket;
- pollfd.client_data = NULL;
- apr_pollset_add(pollset, &pollfd);
-
- /* Add the server side to the poll */
- pollfd.desc.s = sock;
- apr_pollset_add(pollset, &pollfd);
-
while (1) { /* Infinite loop until error (one side closes the connection) */
if ((rv = apr_pollset_poll(pollset, -1, &pollcnt, &signalled)) != APR_SUCCESS) {
if (APR_STATUS_IS_EINTR(rv)) {
@@ -297,7 +372,7 @@
}
#ifdef DEBUGGING
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
- "proxy: CONNECT: woke from select(), i=%d", pollcnt);
+ "proxy: CONNECT: woke from poll(), i=%d", pollcnt);
#endif
for (pi = 0; pi < pollcnt; pi++) {
@@ -307,72 +382,32 @@
pollevent = cur->rtnevents;
if (pollevent & APR_POLLIN) {
#ifdef DEBUGGING
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
- "proxy: CONNECT: sock was set");
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ "proxy: CONNECT: sock was readable");
#endif
- nbytes = sizeof(buffer);
- rv = apr_socket_recv(sock, buffer, &nbytes);
- if (rv == APR_SUCCESS) {
- o = 0;
- i = nbytes;
- while(i > 0)
- {
- nbytes = i;
- /* This is just plain wrong. No module should ever write directly
- * to the client. For now, this works, but this is high on my list of
- * things to fix. The correct line is:
- * if ((nbytes = ap_rwrite(buffer + o, nbytes, r)) < 0)
- * rbb
- */
- rv = apr_socket_send(client_socket, buffer + o, &nbytes);
- if (rv != APR_SUCCESS)
- break;
- o += nbytes;
- i -= nbytes;
- }
+ rv = proxy_connect_transfer(r, backconn, c, bb, "sock");
}
- else
- break;
+ else if ((pollevent & APR_POLLERR) || (pollevent & APR_POLLHUP)) {
+ rv = APR_EPIPE;
+ ap_log_rerror(APLOG_MARK, APLOG_NOTICE, 0, r, "proxy: CONNECT: err/hup on backconn");
}
- else if ((pollevent & APR_POLLERR) || (pollevent & APR_POLLHUP))
- break;
}
else if (cur->desc.s == client_socket) {
pollevent = cur->rtnevents;
if (pollevent & APR_POLLIN) {
#ifdef DEBUGGING
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
- "proxy: CONNECT: client was set");
-#endif
- nbytes = sizeof(buffer);
- rv = apr_socket_recv(client_socket, buffer, &nbytes);
- if (rv == APR_SUCCESS) {
- o = 0;
- i = nbytes;
-#ifdef DEBUGGING
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
- "proxy: CONNECT: read %d from client", i);
+ ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
+ "proxy: CONNECT: client was readable");
#endif
- while(i > 0)
- {
- nbytes = i;
- rv = apr_socket_send(sock, buffer + o, &nbytes);
- if (rv != APR_SUCCESS)
- break;
- o += nbytes;
- i -= nbytes;
- }
- }
- else
- break;
+ rv = proxy_connect_transfer(r, c, backconn, bb, "client");
}
- else if ((pollevent & APR_POLLERR) || (pollevent & APR_POLLHUP)) {
- rv = APR_EOF;
- break;
}
+ else {
+ rv = APR_EBADF;
+ ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
+ "proxy: CONNECT: unknown socket in pollset");
}
- else
- break;
+
}
if (rv != APR_SUCCESS) {
break;
@@ -388,7 +423,9 @@
* Close the socket and clean up
*/
- apr_socket_close(sock);
+ ap_lingering_close(backconn);
+
+ c->aborted = 1;
return OK;
}

View File

@@ -1,15 +0,0 @@
$NetBSD: patch-modules_ssl_ssl__engine__kernel.c,v 1.1 2012/12/23 21:32:42 spz Exp $
https://issues.apache.org/bugzilla/show_bug.cgi?id=49491
--- ./modules/ssl/ssl_engine_kernel.c.orig 2012-08-20 15:53:11.000000000 +0000
+++ ./modules/ssl/ssl_engine_kernel.c 2012-12-21 08:18:57.000000000 +0000
@@ -136,7 +136,7 @@ int ssl_hook_ReadReq(request_rec *r)
if (rv != APR_SUCCESS || scope_id) {
return HTTP_BAD_REQUEST;
}
- if (strcmp(host, servername)) {
+ if (strcasecmp(host, servername)) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
"Hostname %s provided via SNI and hostname %s provided"
" via HTTP are different", servername, host);