Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kazeburo/01d1901eece9341aaaa92194ce1b4251 to your computer and use it in GitHub Desktop.
Save kazeburo/01d1901eece9341aaaa92194ce1b4251 to your computer and use it in GitHub Desktop.
diff -ur nginx-1.18.0.orig/src/http/ngx_http_upstream.c nginx-1.18.0/src/http/ngx_http_upstream.c
--- nginx-1.18.0.orig/src/http/ngx_http_upstream.c 2020-04-21 23:09:01.000000000 +0900
+++ nginx-1.18.0/src/http/ngx_http_upstream.c 2020-07-30 11:28:08.000000000 +0900
@@ -192,6 +192,8 @@
ngx_http_upstream_t *u, ngx_connection_t *c);
#endif
+extern ngx_int_t ngx_http_upstream_dynamic_resolve_directive(ngx_conf_t *cf,
+ ngx_http_upstream_server_t *us, ngx_uint_t *i);
static ngx_http_upstream_header_t ngx_http_upstream_headers_in[] = {
@@ -5858,6 +5860,13 @@
for (i = 2; i < cf->args->nelts; i++) {
+ ngx_int_t res = ngx_http_upstream_dynamic_resolve_directive(cf, us, &i);
+ if (res == NGX_ERROR) {
+ goto invalid;
+ } else if (res == NGX_AGAIN) {
+ continue;
+ }
+
if (ngx_strncmp(value[i].data, "weight=", 7) == 0) {
if (!(uscf->flags & NGX_HTTP_UPSTREAM_WEIGHT)) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment