summaryrefslogtreecommitdiffstatsabout
path: root/src/gnutls_io.c
diff options
context:
space:
mode:
authorPaul Querna <chip@outoforder.cc>2004-12-09 07:52:31 (GMT)
committer Paul Querna <chip@outoforder.cc>2004-12-09 07:52:31 (GMT)
commit32f2e601850dbbfb34180763df507d103c6b6aff (patch)
tree9b50b30743958f0a4e2c71f3d7f762b6170952f9 /src/gnutls_io.c
parent0314debf01c32040851395b66669b75bbc1220cc (diff)
fixes and stuff that i should of already committed.
Diffstat (limited to 'src/gnutls_io.c')
-rw-r--r--src/gnutls_io.c59
1 files changed, 6 insertions, 53 deletions
diff --git a/src/gnutls_io.c b/src/gnutls_io.c
index 856b6a3..e1c84be 100644
--- a/src/gnutls_io.c
+++ b/src/gnutls_io.c
@@ -332,46 +332,12 @@ static apr_status_t gnutls_io_input_getline(mod_gnutls_handle_t * ctxt,
332} 332}
333 333
334 334
335#define GNUTLS_HANDSHAKE_ATTEMPTS 10
336
337static void gnutls_do_handshake(mod_gnutls_handle_t * ctxt) 335static void gnutls_do_handshake(mod_gnutls_handle_t * ctxt)
338{ 336{
339 int i, ret; 337 int ret;
340 338
341 if (ctxt->status != 0) 339 if (ctxt->status != 0)
342 return; 340 return;
343#if 0
344
345 for (i = GNUTLS_HANDSHAKE_ATTEMPTS; i > 0; i--) {
346 ret = gnutls_handshake(ctxt->session);
347 if (ret == GNUTLS_E_INTERRUPTED || ret == GNUTLS_E_AGAIN) {
348 continue;
349 }
350
351 if (ret < 0) {
352 if (ret == GNUTLS_E_WARNING_ALERT_RECEIVED
353 || ret == GNUTLS_E_FATAL_ALERT_RECEIVED) {
354 ret = gnutls_alert_get(ctxt->session);
355 ap_log_error(APLOG_MARK, APLOG_ERR, 0, ctxt->c->base_server,
356 "GnuTLS: Hanshake Alert (%d) '%s'.\n", ret,
357 gnutls_alert_get_name(ret));
358 }
359
360 gnutls_deinit(ctxt->session);
361 ap_log_error(APLOG_MARK, APLOG_ERR, 0, ctxt->c->base_server,
362 "GnuTLS: Handshake Failed (%d) '%s'", ret,
363 gnutls_strerror(ret));
364 ctxt->status = -1;
365 return;
366 }
367 else {
368 ctxt->status = 1;
369 return; /* all done with the handshake */
370 }
371 }
372 ctxt->status = -1;
373 return;
374#else
375 ret = gnutls_handshake(ctxt->session); 341 ret = gnutls_handshake(ctxt->session);
376 if (ret < 0) { 342 if (ret < 0) {
377 if (ret == GNUTLS_E_WARNING_ALERT_RECEIVED 343 if (ret == GNUTLS_E_WARNING_ALERT_RECEIVED
@@ -393,8 +359,6 @@ static void gnutls_do_handshake(mod_gnutls_handle_t * ctxt)
393 ctxt->status = 1; 359 ctxt->status = 1;
394 return; /* all done with the handshake */ 360 return; /* all done with the handshake */
395 } 361 }
396
397#endif
398} 362}
399 363
400 364
@@ -465,7 +429,7 @@ apr_status_t mod_gnutls_filter_input(ap_filter_t * f,
465apr_status_t mod_gnutls_filter_output(ap_filter_t * f, 429apr_status_t mod_gnutls_filter_output(ap_filter_t * f,
466 apr_bucket_brigade * bb) 430 apr_bucket_brigade * bb)
467{ 431{
468 int ret; 432 apr_size_t ret;
469 mod_gnutls_handle_t *ctxt = (mod_gnutls_handle_t *) f->ctx; 433 mod_gnutls_handle_t *ctxt = (mod_gnutls_handle_t *) f->ctx;
470 apr_status_t status = APR_SUCCESS; 434 apr_status_t status = APR_SUCCESS;
471 apr_read_type_e rblock = APR_NONBLOCK_READ; 435 apr_read_type_e rblock = APR_NONBLOCK_READ;
@@ -513,7 +477,6 @@ apr_status_t mod_gnutls_filter_output(ap_filter_t * f,
513 477
514 } 478 }
515 else { 479 else {
516
517 /* filter output */ 480 /* filter output */
518 const char *data; 481 const char *data;
519 apr_size_t len; 482 apr_size_t len;
@@ -546,20 +509,10 @@ apr_status_t mod_gnutls_filter_output(ap_filter_t * f,
546 ctxt->output_rc = APR_EGENERAL; 509 ctxt->output_rc = APR_EGENERAL;
547 } 510 }
548 } 511 }
549 else if ((apr_size_t) ret != len) { 512 else if (ret != len) {
550 //apr_bucket_split(bucket, ret); 513 /* Not able to send the entire bucket,
551 //APR_BUCKET_REMOVE(bucket); 514 split it and send it again. */
552 /* not all of the data was sent. */ 515 apr_bucket_split(bucket, ret);
553 /* mod_ssl basicly errors out here.. this doesn't seem right? */
554 ap_log_error(APLOG_MARK, APLOG_INFO, ctxt->output_rc,
555 ctxt->c->base_server,
556 "GnuTLS: failed to write %" APR_SSIZE_T_FMT
557 " of %" APR_SIZE_T_FMT " bytes.",
558 len - (apr_size_t) ret, len);
559 //continue;
560 if (ctxt->output_rc == APR_SUCCESS) {
561 ctxt->output_rc = APR_EGENERAL;
562 }
563 } 516 }
564 517
565 apr_bucket_delete(bucket); 518 apr_bucket_delete(bucket);