From 60cf11c4c8c984d7fafd369171bfa950eefd3c4f Mon Sep 17 00:00:00 2001 From: Dash Shendy Date: Fri, 8 Jul 2011 23:04:16 +0200 Subject: Proxy (TLS termination) patch Signed-off-by: Dash Shendy --- src/gnutls_hooks.c | 14 ++++++++------ src/gnutls_io.c | 6 +++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/gnutls_hooks.c b/src/gnutls_hooks.c index 2999aae..4b9e964 100644 --- a/src/gnutls_hooks.c +++ b/src/gnutls_hooks.c @@ -738,8 +738,9 @@ int mgs_hook_pre_connection(conn_rec * c, void *csd) _gnutls_log(debug_log_fp, "%s: %d\n", __func__, __LINE__); - if (c == NULL) - return DECLINED; + if (c == NULL) { + return DECLINED; + } sc = (mgs_srvconf_rec *) ap_get_module_config(c->base_server-> module_config, @@ -749,10 +750,11 @@ int mgs_hook_pre_connection(conn_rec * c, void *csd) return DECLINED; } - if (c->remote_addr->hostname) - /* Connection initiated by Apache (mod_proxy) => ignore */ - return OK; - + if (c->remote_addr->hostname || apr_strnatcmp(c->remote_ip,c->local_ip) == 0) { + /* Connection initiated by Apache (mod_proxy) => ignore */ + return OK; + } + ctxt = create_gnutls_handle(c->pool, c); ap_set_module_config(c->conn_config, &gnutls_module, ctxt); diff --git a/src/gnutls_io.c b/src/gnutls_io.c index 4a550c3..a434eb5 100644 --- a/src/gnutls_io.c +++ b/src/gnutls_io.c @@ -666,9 +666,9 @@ ssize_t mgs_transport_read(gnutls_transport_ptr_t ptr, ctxt->input_rc = APR_SUCCESS; /* If Len = 0, we don't do anything. */ - if (!len) - return 0; - + if (!len || buffer == NULL) { + return 0; + } if (!ctxt->input_bb) { ctxt->input_rc = APR_EOF; return -1; -- cgit