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

Function ssl_var_lookup

modules/ssl/ssl_engine_vars.c:163–344  ·  view source on GitHub ↗

This function must remain safe to use for a non-SSL connection. */

Source from the content-addressed store, hash-verified

161
162/* This function must remain safe to use for a non-SSL connection. */
163char *ssl_var_lookup(apr_pool_t *p, server_rec *s, conn_rec *c, request_rec *r, char *var)
164{
165 SSLModConfigRec *mc = myModConfig(s);
166 const char *result;
167 BOOL resdup;
168 apr_time_exp_t tm;
169
170 result = NULL;
171 resdup = TRUE;
172
173 /*
174 * When no pool is given try to find one
175 */
176 if (p == NULL) {
177 if (r != NULL)
178 p = r->pool;
179 else if (c != NULL)
180 p = c->pool;
181 else
182 p = mc->pPool;
183 }
184
185 /*
186 * Request dependent stuff
187 */
188 if (r != NULL) {
189 switch (var[0]) {
190 case 'H':
191 case 'h':
192 if (strcEQ(var, "HTTP_USER_AGENT"))
193 result = apr_table_get(r->headers_in, "User-Agent");
194 else if (strcEQ(var, "HTTP_REFERER"))
195 result = apr_table_get(r->headers_in, "Referer");
196 else if (strcEQ(var, "HTTP_COOKIE"))
197 result = apr_table_get(r->headers_in, "Cookie");
198 else if (strcEQ(var, "HTTP_FORWARDED"))
199 result = apr_table_get(r->headers_in, "Forwarded");
200 else if (strcEQ(var, "HTTP_HOST"))
201 result = apr_table_get(r->headers_in, "Host");
202 else if (strcEQ(var, "HTTP_PROXY_CONNECTION"))
203 result = apr_table_get(r->headers_in, "Proxy-Connection");
204 else if (strcEQ(var, "HTTP_ACCEPT"))
205 result = apr_table_get(r->headers_in, "Accept");
206 else if (strlen(var) > 5 && strcEQn(var, "HTTP:", 5))
207 /* all other headers from which we are still not know about */
208 result = apr_table_get(r->headers_in, var+5);
209 break;
210
211 case 'R':
212 case 'r':
213 if (strcEQ(var, "REQUEST_METHOD"))
214 result = r->method;
215 else if (strcEQ(var, "REQUEST_SCHEME"))
216 result = ap_http_scheme(r);
217 else if (strcEQ(var, "REQUEST_URI"))
218 result = r->uri;
219 else if (strcEQ(var, "REQUEST_FILENAME"))
220 result = r->filename;

Callers 8

ssl_io_filter_handshakeFunction · 0.70
ssl_hook_AccessFunction · 0.70
ssl_hook_FixupFunction · 0.70
log_tracing_stateFunction · 0.70
expr_func_fnFunction · 0.70
ssl_var_log_handler_cFunction · 0.70
ssl_var_log_handler_xFunction · 0.70

Calls 9

ap_get_useragent_hostFunction · 0.85
ap_get_remote_lognameFunction · 0.85
ap_get_server_portFunction · 0.85
ap_document_rootFunction · 0.85
ssl_get_effective_configFunction · 0.85
ssl_var_lookup_sslFunction · 0.85
ap_get_server_bannerFunction · 0.85

Tested by

no test coverage detected