comparison src/http/ngx_http_core_module.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 ef6a3a99a81a
children 711737177b77
comparison
equal deleted inserted replaced
8030:cdc2724858ca 8031:d26db4f82d7d
1005 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); 1005 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
1006 return NGX_OK; 1006 return NGX_OK;
1007 } 1007 }
1008 1008
1009 r->headers_out.location->hash = 1; 1009 r->headers_out.location->hash = 1;
1010 r->headers_out.location->next = NULL;
1010 ngx_str_set(&r->headers_out.location->key, "Location"); 1011 ngx_str_set(&r->headers_out.location->key, "Location");
1011 1012
1012 if (r->args.len == 0) { 1013 if (r->args.len == 0) {
1013 r->headers_out.location->value = clcf->escaped_name; 1014 r->headers_out.location->value = clcf->escaped_name;
1014 1015
1685 if (etag == NULL) { 1686 if (etag == NULL) {
1686 return NGX_ERROR; 1687 return NGX_ERROR;
1687 } 1688 }
1688 1689
1689 etag->hash = 1; 1690 etag->hash = 1;
1691 etag->next = NULL;
1690 ngx_str_set(&etag->key, "ETag"); 1692 ngx_str_set(&etag->key, "ETag");
1691 1693
1692 etag->value.data = ngx_pnalloc(r->pool, NGX_OFF_T_LEN + NGX_TIME_T_LEN + 3); 1694 etag->value.data = ngx_pnalloc(r->pool, NGX_OFF_T_LEN + NGX_TIME_T_LEN + 3);
1693 if (etag->value.data == NULL) { 1695 if (etag->value.data == NULL) {
1694 etag->hash = 0; 1696 etag->hash = 0;
1779 if (r->headers_out.location == NULL) { 1781 if (r->headers_out.location == NULL) {
1780 return NGX_HTTP_INTERNAL_SERVER_ERROR; 1782 return NGX_HTTP_INTERNAL_SERVER_ERROR;
1781 } 1783 }
1782 1784
1783 r->headers_out.location->hash = 1; 1785 r->headers_out.location->hash = 1;
1786 r->headers_out.location->next = NULL;
1784 ngx_str_set(&r->headers_out.location->key, "Location"); 1787 ngx_str_set(&r->headers_out.location->key, "Location");
1785 r->headers_out.location->value = val; 1788 r->headers_out.location->value = val;
1786 1789
1787 return status; 1790 return status;
1788 } 1791 }