| 1107 | |
| 1108 | |
| 1109 | static int config_log_transaction(request_rec *r, config_log_state *cls, |
| 1110 | apr_array_header_t *default_format) |
| 1111 | { |
| 1112 | log_format_item *items; |
| 1113 | const char **strs; |
| 1114 | int *strl; |
| 1115 | request_rec *orig; |
| 1116 | int i; |
| 1117 | apr_size_t len = 0; |
| 1118 | apr_array_header_t *format; |
| 1119 | char *envar; |
| 1120 | apr_status_t rv; |
| 1121 | |
| 1122 | if (cls->fname == NULL) { |
| 1123 | return DECLINED; |
| 1124 | } |
| 1125 | |
| 1126 | /* |
| 1127 | * See if we've got any conditional envariable-controlled logging decisions |
| 1128 | * to make. |
| 1129 | */ |
| 1130 | if (cls->condition_var != NULL) { |
| 1131 | envar = cls->condition_var; |
| 1132 | if (*envar != '!') { |
| 1133 | if (apr_table_get(r->subprocess_env, envar) == NULL) { |
| 1134 | return DECLINED; |
| 1135 | } |
| 1136 | } |
| 1137 | else { |
| 1138 | if (apr_table_get(r->subprocess_env, &envar[1]) != NULL) { |
| 1139 | return DECLINED; |
| 1140 | } |
| 1141 | } |
| 1142 | } |
| 1143 | else if (cls->condition_expr != NULL) { |
| 1144 | const char *err; |
| 1145 | int rc = ap_expr_exec(r, cls->condition_expr, &err); |
| 1146 | if (rc < 0) |
| 1147 | ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(00644) |
| 1148 | "Error evaluating log condition: %s", err); |
| 1149 | if (rc <= 0) |
| 1150 | return DECLINED; |
| 1151 | } |
| 1152 | |
| 1153 | format = cls->format ? cls->format : default_format; |
| 1154 | |
| 1155 | strs = apr_palloc(r->pool, sizeof(char *) * (format->nelts)); |
| 1156 | strl = apr_palloc(r->pool, sizeof(int) * (format->nelts)); |
| 1157 | items = (log_format_item *) format->elts; |
| 1158 | |
| 1159 | orig = r; |
| 1160 | while (orig->prev) { |
| 1161 | orig = orig->prev; |
| 1162 | } |
| 1163 | while (r->next) { |
| 1164 | r = r->next; |
| 1165 | } |
| 1166 |
no test coverage detected