From 0b3bc057ca6c68214614f257704cb5a332747b75 Mon Sep 17 00:00:00 2001 From: Paul Querna Date: Thu, 2 Dec 2004 21:35:29 +0000 Subject: setting proper ignores. adding an empty cache files trying to fix >16kb writes. --- src/gnutls_cache.c | 25 +++++++++++++++++++++++++ src/gnutls_io.c | 31 +++++++++++++++++++++++++------ 2 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 src/gnutls_cache.c (limited to 'src') diff --git a/src/gnutls_cache.c b/src/gnutls_cache.c new file mode 100644 index 0000000..f2fb803 --- /dev/null +++ b/src/gnutls_cache.c @@ -0,0 +1,25 @@ +/* ==================================================================== + * Copyright 2004 Paul Querna + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "mod_gnutls.h" + +/** + * GnuTLS Session Cache using libmemcached + * + */ + +#include "libmemcache/memcache.h" diff --git a/src/gnutls_io.c b/src/gnutls_io.c index ec2d08c..856b6a3 100644 --- a/src/gnutls_io.c +++ b/src/gnutls_io.c @@ -372,7 +372,7 @@ static void gnutls_do_handshake(mod_gnutls_handle_t * ctxt) ctxt->status = -1; return; #else -ret = gnutls_handshake(ctxt->session); + ret = gnutls_handshake(ctxt->session); if (ret < 0) { if (ret == GNUTLS_E_WARNING_ALERT_RECEIVED || ret == GNUTLS_E_FATAL_ALERT_RECEIVED) { @@ -419,7 +419,7 @@ apr_status_t mod_gnutls_filter_input(ap_filter_t * f, } if (ctxt->status < 0) { -// return ap_get_brigade(f->next, bb, mode, block, readbytes); + return ap_get_brigade(f->next, bb, mode, block, readbytes); } /* XXX: we don't currently support anything other than these modes. */ @@ -485,22 +485,35 @@ apr_status_t mod_gnutls_filter_output(ap_filter_t * f, while (!APR_BRIGADE_EMPTY(bb)) { apr_bucket *bucket = APR_BRIGADE_FIRST(bb); - if (APR_BUCKET_IS_EOS(bucket) || APR_BUCKET_IS_FLUSH(bucket)) { - /** TODO: GnuTLS doesn't have a special flush method? **/ + if (APR_BUCKET_IS_EOS(bucket)) { + + /* gnutls_bye(ctxt->session, GNUTLS_SHUT_RDWR); */ + + if ((status = ap_pass_brigade(f->next, bb)) != APR_SUCCESS) { + return status; + } + break; + + } else if (APR_BUCKET_IS_FLUSH(bucket)) { + if ((status = ap_pass_brigade(f->next, bb)) != APR_SUCCESS) { return status; } break; + } else if (AP_BUCKET_IS_EOC(bucket)) { - gnutls_bye(ctxt->session, GNUTLS_SHUT_WR); + gnutls_bye(ctxt->session, GNUTLS_SHUT_WR); + gnutls_deinit(ctxt->session); if ((status = ap_pass_brigade(f->next, bb)) != APR_SUCCESS) { return status; } break; + } else { + /* filter output */ const char *data; apr_size_t len; @@ -518,7 +531,10 @@ apr_status_t mod_gnutls_filter_output(ap_filter_t * f, break; } - ret = gnutls_record_send(ctxt->session, data, len); + do { + ret = gnutls_record_send(ctxt->session, data, len); + } + while(ret == GNUTLS_E_INTERRUPTED || ret == GNUTLS_E_AGAIN); if (ret < 0) { /* error sending output */ @@ -531,6 +547,8 @@ apr_status_t mod_gnutls_filter_output(ap_filter_t * f, } } else if ((apr_size_t) ret != len) { + //apr_bucket_split(bucket, ret); + //APR_BUCKET_REMOVE(bucket); /* not all of the data was sent. */ /* mod_ssl basicly errors out here.. this doesn't seem right? */ ap_log_error(APLOG_MARK, APLOG_INFO, ctxt->output_rc, @@ -538,6 +556,7 @@ apr_status_t mod_gnutls_filter_output(ap_filter_t * f, "GnuTLS: failed to write %" APR_SSIZE_T_FMT " of %" APR_SIZE_T_FMT " bytes.", len - (apr_size_t) ret, len); + //continue; if (ctxt->output_rc == APR_SUCCESS) { ctxt->output_rc = APR_EGENERAL; } -- cgit