MCPcopy Create free account
hub / github.com/apache/httpd / ssl_init_connection_ctx

Function ssl_init_connection_ctx

modules/ssl/mod_ssl.c:461–509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

459}
460
461static SSLConnRec *ssl_init_connection_ctx(conn_rec *c,
462 ap_conf_vector_t *per_dir_config,
463 int reinit)
464{
465 SSLConnRec *sslconn = myConnConfig(c);
466 int need_setup = 0;
467
468 /* mod_proxy's (r->)per_dir_config has the lifetime of the request, thus
469 * it uses ssl_engine_set() to reset sslconn->dc when reusing SSL backend
470 * connections, so we must fall through here. But in the case where we are
471 * called from ssl_init_ssl_connection() with no per_dir_config (which also
472 * includes mod_proxy's later run_pre_connection call), sslconn->dc should
473 * be preserved if it's already set.
474 */
475 if (!sslconn) {
476 sslconn = apr_pcalloc(c->pool, sizeof(*sslconn));
477 need_setup = 1;
478 }
479 else if (!reinit) {
480 return sslconn;
481 }
482
483 /* Reinit dc in any case because it may be r->per_dir_config scoped
484 * and thus a caller like mod_proxy needs to update it per request.
485 */
486 if (per_dir_config) {
487 sslconn->dc = ap_get_module_config(per_dir_config, &ssl_module);
488 }
489 else {
490 sslconn->dc = ap_get_module_config(c->base_server->lookup_defaults,
491 &ssl_module);
492 }
493
494 if (need_setup) {
495 sslconn->server = c->base_server;
496 sslconn->verify_depth = UNSET;
497 if (c->outgoing) {
498 sslconn->cipher_suite = sslconn->dc->proxy->auth.cipher_suite;
499 }
500 else {
501 SSLSrvConfigRec *sc = mySrvConfig(c->base_server);
502 sslconn->cipher_suite = sc->server->auth.cipher_suite;
503 }
504
505 myConnConfigSet(c, sslconn);
506 }
507
508 return sslconn;
509}
510
511static int ssl_engine_status(conn_rec *c, SSLConnRec *sslconn)
512{

Callers 2

ssl_init_ssl_connectionFunction · 0.85

Calls 1

ap_get_module_configFunction · 0.85

Tested by

no test coverage detected