diff options
author | Omar Polo <op@omarpolo.com> | 2021-04-30 17:16:34 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2021-04-30 17:16:34 +0000 |
commit | fdea6aa0bca24f6f947e2126ce101fd59caa7a31 (patch) | |
tree | c167f225e73250eb8cc82347a23ce7a86cfbf027 /parse.y | |
parent | adbe6a6493c0e91fcfc918db8f4b5839a2867b1c (diff) |
allow ``root'' rule to be specified per-location block
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -108,8 +108,7 @@ vhost : TSERVER TSTRING { } } '{' servopts locations '}' { - if (host->cert == NULL || host->key == NULL || - host->dir == NULL) + if (host->cert == NULL || host->key == NULL) yyerror("invalid vhost definition: %s", $2); } | error '}' { yyerror("error in server directive"); } @@ -155,7 +154,6 @@ servopt : TALIAS TSTRING { TAILQ_INSERT_TAIL(&host->env, e, envs); } | TKEY TSTRING { host->key = ensure_absolute_path($2); } - | TROOT TSTRING { host->dir = ensure_absolute_path($2); } | locopt ; @@ -222,6 +220,12 @@ locopt : TAUTO TINDEX TBOOL { loc->auto_index = $3 ? 1 : -1; } yyerror("couldn't load ca cert: %s", $4); free($4); } + | TROOT TSTRING { + if (loc->dir != NULL) + yyerror("`root' specified more than once"); + + loc->dir = ensure_absolute_path($2); + } | TSTRIP TNUM { loc->strip = check_strip_no($2); } ; @@ -236,7 +240,11 @@ new_vhost(void) static struct location * new_location(void) { - return xcalloc(1, sizeof(struct location)); + struct location *l; + + l = xcalloc(1, sizeof(*l)); + l->dirfd = -1; + return l; } void |