comparison src/http/modules/ngx_http_realip_module.c @ 7590:06b01840bd42

Core: moved PROXY protocol fields out of ngx_connection_t. Now a new structure ngx_proxy_protocol_t holds these fields. This allows to add more PROXY protocol fields in the future without modifying the connection structure.
author Roman Arutyunyan <arut@nginx.com>
date Mon, 21 Oct 2019 18:06:19 +0300
parents 2a288909abc6
children ef6a3a99a81a
comparison
equal deleted inserted replaced
7589:486d2e0b1b6f 7590:06b01840bd42
178 178
179 break; 179 break;
180 180
181 case NGX_HTTP_REALIP_PROXY: 181 case NGX_HTTP_REALIP_PROXY:
182 182
183 value = &r->connection->proxy_protocol_addr; 183 if (r->connection->proxy_protocol == NULL) {
184
185 if (value->len == 0) {
186 return NGX_DECLINED; 184 return NGX_DECLINED;
187 } 185 }
188 186
187 value = &r->connection->proxy_protocol->src_addr;
189 xfwd = NULL; 188 xfwd = NULL;
190 189
191 break; 190 break;
192 191
193 default: /* NGX_HTTP_REALIP_HEADER */ 192 default: /* NGX_HTTP_REALIP_HEADER */
236 if (ngx_http_get_forwarded_addr(r, &addr, xfwd, value, rlcf->from, 235 if (ngx_http_get_forwarded_addr(r, &addr, xfwd, value, rlcf->from,
237 rlcf->recursive) 236 rlcf->recursive)
238 != NGX_DECLINED) 237 != NGX_DECLINED)
239 { 238 {
240 if (rlcf->type == NGX_HTTP_REALIP_PROXY) { 239 if (rlcf->type == NGX_HTTP_REALIP_PROXY) {
241 ngx_inet_set_port(addr.sockaddr, c->proxy_protocol_port); 240 ngx_inet_set_port(addr.sockaddr, c->proxy_protocol->src_port);
242 } 241 }
243 242
244 return ngx_http_realip_set_addr(r, &addr); 243 return ngx_http_realip_set_addr(r, &addr);
245 } 244 }
246 245