Changeset fcb122d in mod_gnutls for src/gnutls_io.c


Ignore:
Timestamp:
Apr 5, 2005, 12:39:18 PM (14 years ago)
Author:
Paul Querna <chip@…>
Branches:
debian/master, debian/stretch-backports, jessie-backports, master, msva, upstream
Children:
42307a9
Parents:
6e0bfd6
Message:

checkpoint the work so far. The DBM cache needs a little more work.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gnutls_io.c

    r6e0bfd6 rfcb122d  
    1 /* ====================================================================
    2  *  Copyright 2004 Paul Querna
     1/**
     2 *  Copyright 2004-2005 Paul Querna
    33 *
    44 *  Licensed under the Apache License, Version 2.0 (the "License");
     
    343343    int ret;
    344344
    345     if (ctxt->status != 0)
     345    if (ctxt->status != 0) {
    346346        return;
    347         ret = gnutls_handshake(ctxt->session);
    348         if (ret < 0) {
    349             if (ret == GNUTLS_E_WARNING_ALERT_RECEIVED
    350                 || ret == GNUTLS_E_FATAL_ALERT_RECEIVED) {
    351                 ret = gnutls_alert_get(ctxt->session);
    352                 ap_log_error(APLOG_MARK, APLOG_ERR, 0, ctxt->c->base_server,
    353                              "GnuTLS: Hanshake Alert (%d) '%s'.\n", ret,
    354                              gnutls_alert_get_name(ret));
    355             }
     347    }
     348
     349tryagain:
     350
     351    ret = gnutls_handshake(ctxt->session);
     352    if (ret < 0) {
     353        if (ret == GNUTLS_E_WARNING_ALERT_RECEIVED
     354            || ret == GNUTLS_E_FATAL_ALERT_RECEIVED) {
     355            ret = gnutls_alert_get(ctxt->session);
     356            ap_log_error(APLOG_MARK, APLOG_ERR, 0, ctxt->c->base_server,
     357                         "GnuTLS: Hanshake Alert (%d) '%s'.\n", ret,
     358                         gnutls_alert_get_name(ret));
     359        }
    356360   
    357             gnutls_deinit(ctxt->session);
    358             ap_log_error(APLOG_MARK, APLOG_ERR, 0, ctxt->c->base_server,
    359                              "GnuTLS: Handshake Failed (%d) '%s'", ret,
    360                              gnutls_strerror(ret));
    361                 ctxt->status = -1;
    362                 return;
    363         }
    364         else {
    365             ctxt->status = 1;
    366             return;             /* all done with the handshake */
    367         }
    368 }
    369 
    370 
    371 apr_status_t mod_gnutls_filter_input(ap_filter_t * f,
     361        if (!gnutls_error_is_fatal(ret)) {
     362            ap_log_error(APLOG_MARK, APLOG_INFO, 0, ctxt->c->base_server,
     363                     "GnuTLS: Non-Fatal Handshake Error: (%d) '%s'", ret,
     364                      gnutls_strerror(ret));
     365            goto tryagain;
     366        }
     367
     368        ap_log_error(APLOG_MARK, APLOG_ERR, 0, ctxt->c->base_server,
     369                     "GnuTLS: Handshake Failed (%d) '%s'", ret,
     370                      gnutls_strerror(ret));
     371        ctxt->status = -1;
     372        gnutls_alert_send(ctxt->session, GNUTLS_AL_FATAL,
     373                          gnutls_error_to_alert(ret, NULL));
     374        gnutls_deinit(ctxt->session);
     375        return;
     376    }
     377    else {
     378        ctxt->status = 1;
     379        return;             /* all done with the handshake */
     380    }
     381}
     382
     383
     384apr_status_t mod_gnutls_filter_input(ap_filter_t* f,
    372385                                     apr_bucket_brigade * bb,
    373386                                     ap_input_mode_t mode,
     
    456469    while (!APR_BRIGADE_EMPTY(bb)) {
    457470        apr_bucket *bucket = APR_BRIGADE_FIRST(bb);
    458         if (APR_BUCKET_IS_EOS(bucket) || AP_BUCKET_IS_EOC(bucket)) {
     471        if (AP_BUCKET_IS_EOC(bucket)) {
    459472
    460473            gnutls_bye(ctxt->session, GNUTLS_SHUT_WR);
     
    466479            break;
    467480
    468         } else if (APR_BUCKET_IS_FLUSH(bucket)) {
     481        } else if (APR_BUCKET_IS_FLUSH(bucket) || APR_BUCKET_IS_EOS(bucket)) {
    469482
    470483            if ((status = ap_pass_brigade(f->next, bb)) != APR_SUCCESS) {
Note: See TracChangeset for help on using the changeset viewer.