Changeset dae0aec in mod_gnutls for src/mod_gnutls.c


Ignore:
Timestamp:
Sep 27, 2004, 8:20:51 PM (15 years ago)
Author:
Paul Querna <chip@…>
Branches:
debian/master, debian/stretch-backports, jessie-backports, master, msva, upstream
Children:
b1f7f11
Parents:
2e12226
Message:

input and output filters

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mod_gnutls.c

    r2e12226 rdae0aec  
    5858
    5959    /* TODO: Should we regenerate these after X requests / X time ? */
    60 //    gnutls_dh_params_init(&dh_params);
    61 //    gnutls_dh_params_generate2(dh_params, DH_BITS);
     60    gnutls_dh_params_init(&dh_params);
     61    gnutls_dh_params_generate2(dh_params, DH_BITS);
    6262//    gnutls_rsa_params_init(&rsa_params);
    6363//    gnutls_rsa_params_generate2(rsa_params, RSA_BITS);
     
    7171                                                 GNUTLS_X509_FMT_PEM);
    7272//          gnutls_certificate_set_rsa_export_params(sc->certs, rsa_params);
    73 //          gnutls_certificate_set_dh_params(sc->certs, dh_params);
     73          gnutls_certificate_set_dh_params(sc->certs, dh_params);
    7474        }
    7575        else if (sc->enabled == GNUTLS_ENABLED_TRUE) {
     
    113113}
    114114
    115 static int mod_gnutls_hook_pre_connection(conn_rec * c, void *csd)
     115static mod_gnutls_handle_t* create_gnutls_handle(apr_pool_t* pool, conn_rec * c)
    116116{
    117117    mod_gnutls_handle_t *ctxt;
     
    121121                                                        &gnutls_module);
    122122
    123     if (!(sc && (sc->enabled == GNUTLS_ENABLED_TRUE))) {
    124         return DECLINED;
    125     }
    126 
    127     ctxt = apr_pcalloc(c->pool, sizeof(*ctxt));
    128 
     123    ctxt = apr_pcalloc(pool, sizeof(*ctxt));
     124    ctxt->c = c;
    129125    ctxt->sc = sc;
    130126    ctxt->status = 0;
     127
     128    ctxt->input_rc = APR_SUCCESS;
     129    ctxt->input_bb = apr_brigade_create(c->pool, c->bucket_alloc);
     130    ctxt->input_cbuf.length = 0;
     131
     132    ctxt->output_rc = APR_SUCCESS;
     133    ctxt->output_bb = apr_brigade_create(c->pool, c->bucket_alloc);
     134    ctxt->output_blen = 0;
     135    ctxt->output_length = 0;
     136
    131137    gnutls_init(&ctxt->session, GNUTLS_SERVER);
    132138
     
    146152//    gnutls_dh_set_prime_bits(ctxt->session, DH_BITS);
    147153
     154    return ctxt;
     155}
     156
     157static int mod_gnutls_hook_pre_connection(conn_rec * c, void *csd)
     158{
     159    mod_gnutls_handle_t *ctxt;
     160    mod_gnutls_srvconf_rec *sc =
     161        (mod_gnutls_srvconf_rec *) ap_get_module_config(c->base_server->
     162                                                        module_config,
     163                                                        &gnutls_module);
     164
     165    if (!(sc && (sc->enabled == GNUTLS_ENABLED_TRUE))) {
     166        return DECLINED;
     167    }
     168
     169    ctxt = create_gnutls_handle(c->pool, c);
    148170
    149171    ap_set_module_config(c->conn_config, &gnutls_module, ctxt);
     
    154176                                       mod_gnutls_transport_write);
    155177    gnutls_transport_set_ptr(ctxt->session, ctxt);
    156     ap_add_input_filter(GNUTLS_INPUT_FILTER_NAME, ctxt, NULL, c);
    157     ap_add_output_filter(GNUTLS_OUTPUT_FILTER_NAME, ctxt, NULL, c);
     178    ctxt->input_filter = ap_add_input_filter(GNUTLS_INPUT_FILTER_NAME, ctxt, NULL, c);
     179    ctxt->output_filter = ap_add_output_filter(GNUTLS_OUTPUT_FILTER_NAME, ctxt, NULL, c);
    158180
    159181    return OK;
Note: See TracChangeset for help on using the changeset viewer.