Mercurial > hg > nginx
comparison src/http/ngx_http_upstream.c @ 8031:d26db4f82d7d
All known output headers can be linked lists now.
The h->next pointer properly provided as NULL in all cases where known
output headers are added.
Note that there are 3rd party modules which might not do this, and it
might be risky to rely on this for arbitrary headers.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 30 May 2022 21:25:45 +0300 |
parents | cdc2724858ca |
children | 2025aae94739 |
comparison
equal
deleted
inserted
replaced
8030:cdc2724858ca | 8031:d26db4f82d7d |
---|---|
2679 NGX_HTTP_INTERNAL_SERVER_ERROR); | 2679 NGX_HTTP_INTERNAL_SERVER_ERROR); |
2680 return NGX_OK; | 2680 return NGX_OK; |
2681 } | 2681 } |
2682 | 2682 |
2683 *h = *u->headers_in.www_authenticate; | 2683 *h = *u->headers_in.www_authenticate; |
2684 h->next = NULL; | |
2684 | 2685 |
2685 r->headers_out.www_authenticate = h; | 2686 r->headers_out.www_authenticate = h; |
2686 } | 2687 } |
2687 | 2688 |
2688 #if (NGX_HTTP_CACHE) | 2689 #if (NGX_HTTP_CACHE) |
5073 *ho = *h; | 5074 *ho = *h; |
5074 | 5075 |
5075 if (offset) { | 5076 if (offset) { |
5076 ph = (ngx_table_elt_t **) ((char *) &r->headers_out + offset); | 5077 ph = (ngx_table_elt_t **) ((char *) &r->headers_out + offset); |
5077 *ph = ho; | 5078 *ph = ho; |
5079 ho->next = NULL; | |
5078 } | 5080 } |
5079 | 5081 |
5080 return NGX_OK; | 5082 return NGX_OK; |
5081 } | 5083 } |
5082 | 5084 |
5167 if (ho == NULL) { | 5169 if (ho == NULL) { |
5168 return NGX_ERROR; | 5170 return NGX_ERROR; |
5169 } | 5171 } |
5170 | 5172 |
5171 *ho = *h; | 5173 *ho = *h; |
5174 ho->next = NULL; | |
5172 | 5175 |
5173 r->headers_out.last_modified = ho; | 5176 r->headers_out.last_modified = ho; |
5174 r->headers_out.last_modified_time = | 5177 r->headers_out.last_modified_time = |
5175 r->upstream->headers_in.last_modified_time; | 5178 r->upstream->headers_in.last_modified_time; |
5176 | 5179 |
5189 if (ho == NULL) { | 5192 if (ho == NULL) { |
5190 return NGX_ERROR; | 5193 return NGX_ERROR; |
5191 } | 5194 } |
5192 | 5195 |
5193 *ho = *h; | 5196 *ho = *h; |
5197 ho->next = NULL; | |
5194 | 5198 |
5195 if (r->upstream->rewrite_redirect) { | 5199 if (r->upstream->rewrite_redirect) { |
5196 rc = r->upstream->rewrite_redirect(r, ho, 0); | 5200 rc = r->upstream->rewrite_redirect(r, ho, 0); |
5197 | 5201 |
5198 if (rc == NGX_DECLINED) { | 5202 if (rc == NGX_DECLINED) { |
5234 if (ho == NULL) { | 5238 if (ho == NULL) { |
5235 return NGX_ERROR; | 5239 return NGX_ERROR; |
5236 } | 5240 } |
5237 | 5241 |
5238 *ho = *h; | 5242 *ho = *h; |
5243 ho->next = NULL; | |
5239 | 5244 |
5240 if (r->upstream->rewrite_redirect) { | 5245 if (r->upstream->rewrite_redirect) { |
5241 | 5246 |
5242 p = ngx_strcasestrn(ho->value.data, "url=", 4 - 1); | 5247 p = ngx_strcasestrn(ho->value.data, "url=", 4 - 1); |
5243 | 5248 |
5279 if (ho == NULL) { | 5284 if (ho == NULL) { |
5280 return NGX_ERROR; | 5285 return NGX_ERROR; |
5281 } | 5286 } |
5282 | 5287 |
5283 *ho = *h; | 5288 *ho = *h; |
5289 ho->next = NULL; | |
5284 | 5290 |
5285 if (r->upstream->rewrite_cookie) { | 5291 if (r->upstream->rewrite_cookie) { |
5286 rc = r->upstream->rewrite_cookie(r, ho); | 5292 rc = r->upstream->rewrite_cookie(r, ho); |
5287 | 5293 |
5288 if (rc == NGX_DECLINED) { | 5294 if (rc == NGX_DECLINED) { |
5332 if (ho == NULL) { | 5338 if (ho == NULL) { |
5333 return NGX_ERROR; | 5339 return NGX_ERROR; |
5334 } | 5340 } |
5335 | 5341 |
5336 *ho = *h; | 5342 *ho = *h; |
5343 ho->next = NULL; | |
5337 | 5344 |
5338 r->headers_out.accept_ranges = ho; | 5345 r->headers_out.accept_ranges = ho; |
5339 | 5346 |
5340 return NGX_OK; | 5347 return NGX_OK; |
5341 } | 5348 } |