Commit Diff
Diff:
cc1c8f548cd6fda15eac50b3f150acc714ca1545
da2185f37f70f8665c4d800f8f9bbf4027fd7b81
Commit:
da2185f37f70f8665c4d800f8f9bbf4027fd7b81
Tree:
9874f5775e03b863d5e722239ef27b1fa8df7725
Author:
Omar Polo <op@omarpolo.com>
Date:
Sat Jan 1 16:33:40 2022 UTC
Message:
move proxy sub-options to their own rule and allow grouping with { ... }
commit - cc1c8f548cd6fda15eac50b3f150acc714ca1545
commit + da2185f37f70f8665c4d800f8f9bbf4027fd7b81
blob - bab52091a7176665180a57639ab7826c9bb3e6ad
blob + 6fe205d8e071aa0e2b98b9821859871d4d4b9442
--- parse.y
+++ parse.y
@@ -330,14 +330,37 @@ locopt : AUTO INDEX bool { loc->auto_index = $3 ? 1 :
loc->lang = $2;
}
| LOG bool { loc->disable_log = !$2; }
- | PROXY RELAY_TO string {
+ | proxy
+ | REQUIRE CLIENT CA string {
+ only_once(loc->reqca, "require client ca");
+ ensure_absolute_path($4);
+ if ((loc->reqca = load_ca($4)) == NULL)
+ yyerror("couldn't load ca cert: %s", $4);
+ free($4);
+ }
+ | ROOT string {
+ only_once(loc->dir, "root");
+ loc->dir = ensure_absolute_path($2);
+ }
+ | STRIP NUM { loc->strip = check_strip_no($2); }
+ ;
+
+proxy : PROXY proxy_opt
+ | PROXY '{' optnl proxy_opts '}'
+ ;
+
+proxy_opts : /* empty */
+ | proxy_opts proxy_opt optnl
+ ;
+
+proxy_opt : RELAY_TO string {
char *at;
const char *errstr;
only_once(loc->proxy_host, "proxy relay-to");
- loc->proxy_host = $3;
+ loc->proxy_host = $2;
- if ((at = strchr($3, ':')) != NULL) {
+ if ((at = strchr($2, ':')) != NULL) {
*at++ = '\0';
loc->proxy_port = at;
} else
@@ -348,18 +371,6 @@ locopt : AUTO INDEX bool { loc->auto_index = $3 ? 1 :
yyerror("proxy port is %s: %s", errstr,
loc->proxy_port);
}
- | REQUIRE CLIENT CA string {
- only_once(loc->reqca, "require client ca");
- ensure_absolute_path($4);
- if ((loc->reqca = load_ca($4)) == NULL)
- yyerror("couldn't load ca cert: %s", $4);
- free($4);
- }
- | ROOT string {
- only_once(loc->dir, "root");
- loc->dir = ensure_absolute_path($2);
- }
- | STRIP NUM { loc->strip = check_strip_no($2); }
;
fastcgi : SPAWN string {
Omar Polo