summaryrefslogtreecommitdiff
path: root/server/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'server/util.c')
-rw-r--r--server/util.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/server/util.c b/server/util.c
index 916213c380..674118e8ed 100644
--- a/server/util.c
+++ b/server/util.c
@@ -821,6 +821,60 @@ AP_DECLARE(char *) ap_getword_conf(apr_pool_t *p, const char **line)
return res;
}
+AP_DECLARE(char *) ap_getword_conf2_nc(apr_pool_t *p, char **line)
+{
+ return ap_getword_conf2(p, (const char **) line);
+}
+
+AP_DECLARE(char *) ap_getword_conf2(apr_pool_t *p, const char **line)
+{
+ const char *str = *line, *strend;
+ char *res;
+ char quote;
+ int count = 1;
+
+ while (apr_isspace(*str))
+ ++str;
+
+ if (!*str) {
+ *line = str;
+ return "";
+ }
+
+ if ((quote = *str) == '"' || quote == '\'')
+ return ap_getword_conf(p, line);
+
+ if (quote == '{') {
+ strend = str + 1;
+ while (*strend) {
+ if (*strend == '}' && !--count)
+ break;
+ if (*strend == '{')
+ ++count;
+ if (*strend == '\\' && strend[1] && strend[1] == '\\') {
+ ++strend;
+ }
+ ++strend;
+ }
+ res = substring_conf(p, str + 1, strend - str - 1, 0);
+
+ if (*strend == '}')
+ ++strend;
+ }
+ else {
+ strend = str;
+ while (*strend && !apr_isspace(*strend))
+ ++strend;
+
+ res = substring_conf(p, str, strend - str, 0);
+ }
+
+ while (apr_isspace(*strend))
+ ++strend;
+ *line = strend;
+ return res;
+}
+
AP_DECLARE(int) ap_cfg_closefile(ap_configfile_t *cfp)
{
#ifdef DEBUG