MCPcopy Index your code
hub / github.com/apache/httpd / xlate_name

Function xlate_name

modules/proxy/mod_proxy_express.c:112–221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110
111
112static int xlate_name(request_rec *r)
113{
114 int i;
115 const char *name;
116 char *backend = NULL;
117 apr_dbm_t *db;
118 apr_status_t rv;
119 apr_datum_t key, val;
120 struct proxy_alias *ralias;
121 proxy_dir_conf *dconf;
122 express_server_conf *sconf;
123#if APU_MAJOR_VERSION > 1 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 7)
124 const apr_dbm_driver_t *driver;
125 const apu_err_t *err;
126#endif
127
128 sconf = ap_get_module_config(r->server->module_config, &proxy_express_module);
129 dconf = ap_get_module_config(r->per_dir_config, &proxy_module);
130
131 if (!sconf->enabled) {
132 return DECLINED;
133 }
134
135 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01001) "proxy_express: Enabled");
136 if (!sconf->dbmfile || (r->filename && strncmp(r->filename, "proxy:", 6) == 0)) {
137 /* it should be go on as an internal proxy request */
138 return DECLINED;
139 }
140
141 ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01002)
142 "proxy_express: Opening DBM file: %s (%s)",
143 sconf->dbmfile, sconf->dbmtype);
144
145#if APU_MAJOR_VERSION > 1 || (APU_MAJOR_VERSION == 1 && APU_MINOR_VERSION >= 7)
146 rv = apr_dbm_get_driver(&driver, sconf->dbmtype, &err, r->pool);
147 if (rv != APR_SUCCESS) {
148 ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
149 APLOGNO(10275) "The dbm library '%s' could not be loaded: %s (%s: %d)",
150 sconf->dbmtype, err->msg, err->reason, err->rc);
151 return DECLINED;
152 }
153
154 rv = apr_dbm_open2(&db, driver, sconf->dbmfile, APR_DBM_READONLY,
155 APR_OS_DEFAULT, r->pool);
156 if (rv != APR_SUCCESS) {
157 ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
158 APLOGNO(10276) "The '%s' file '%s' could not be loaded",
159 sconf->dbmtype, sconf->dbmfile);
160 return DECLINED;
161 }
162#else
163 rv = apr_dbm_open_ex(&db, sconf->dbmtype, sconf->dbmfile, APR_DBM_READONLY,
164 APR_OS_DEFAULT, r->pool);
165 if (rv != APR_SUCCESS) {
166 return DECLINED;
167 }
168#endif
169

Callers

nothing calls this directly

Calls 2

ap_get_module_configFunction · 0.85
ap_get_server_nameFunction · 0.85

Tested by

no test coverage detected