This function must remain safe to use for a non-SSL connection. */
| 954 | |
| 955 | /* This function must remain safe to use for a non-SSL connection. */ |
| 956 | char *ssl_var_lookup(apr_pool_t *p, server_rec *s, conn_rec *c, request_rec *r, char *var) |
| 957 | { |
| 958 | NWSSLSrvConfigRec *mc = get_nwssl_cfg(s); |
| 959 | const char *result; |
| 960 | BOOL resdup; |
| 961 | apr_time_exp_t tm; |
| 962 | |
| 963 | result = NULL; |
| 964 | resdup = TRUE; |
| 965 | |
| 966 | /* |
| 967 | * When no pool is given try to find one |
| 968 | */ |
| 969 | if (p == NULL) { |
| 970 | if (r != NULL) |
| 971 | p = r->pool; |
| 972 | else if (c != NULL) |
| 973 | p = c->pool; |
| 974 | else |
| 975 | p = mc->pPool; |
| 976 | } |
| 977 | |
| 978 | /* |
| 979 | * Request dependent stuff |
| 980 | */ |
| 981 | if (r != NULL) { |
| 982 | switch (var[0]) { |
| 983 | case 'H': |
| 984 | case 'h': |
| 985 | if (strcEQ(var, "HTTP_USER_AGENT")) |
| 986 | result = apr_table_get(r->headers_in, "User-Agent"); |
| 987 | else if (strcEQ(var, "HTTP_REFERER")) |
| 988 | result = apr_table_get(r->headers_in, "Referer"); |
| 989 | else if (strcEQ(var, "HTTP_COOKIE")) |
| 990 | result = apr_table_get(r->headers_in, "Cookie"); |
| 991 | else if (strcEQ(var, "HTTP_FORWARDED")) |
| 992 | result = apr_table_get(r->headers_in, "Forwarded"); |
| 993 | else if (strcEQ(var, "HTTP_HOST")) |
| 994 | result = apr_table_get(r->headers_in, "Host"); |
| 995 | else if (strcEQ(var, "HTTP_PROXY_CONNECTION")) |
| 996 | result = apr_table_get(r->headers_in, "Proxy-Connection"); |
| 997 | else if (strcEQ(var, "HTTP_ACCEPT")) |
| 998 | result = apr_table_get(r->headers_in, "Accept"); |
| 999 | else if (strcEQ(var, "HTTPS")) { |
| 1000 | if (isSecure(r) || isSecureUpgraded(r)) |
| 1001 | result = "on"; |
| 1002 | else |
| 1003 | result = "off"; |
| 1004 | } |
| 1005 | else if (strlen(var) > 5 && strcEQn(var, "HTTP:", 5)) |
| 1006 | /* all other headers from which we are still not know about */ |
| 1007 | result = apr_table_get(r->headers_in, var+5); |
| 1008 | break; |
| 1009 | |
| 1010 | case 'R': |
| 1011 | case 'r': |
| 1012 | if (strcEQ(var, "REQUEST_METHOD")) |
| 1013 | result = r->method; |
nothing calls this directly
no test coverage detected