Mercurial > hg > nginx-quic
comparison src/http/ngx_http_request.c @ 7885:5b367070cc9c quic
Fixed client buffer reallocation for HTTP/3.
Preserving pointers within the client buffer is not needed for HTTP/3 because
all data is either allocated from pool or static. Unlike with HTTP/1, data
typically cannot be referenced directly within the client buffer. Trying to
preserve NULLs or external pointers lead to broken pointers.
Also, reverted changes in ngx_http_alloc_large_header_buffer() not relevant
for HTTP/3 to minimize diff to mainstream.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Tue, 19 May 2020 16:20:33 +0300 |
parents | d6feece1288a |
children | 7995cd199b52 |
comparison
equal
deleted
inserted
replaced
7884:d6feece1288a | 7885:5b367070cc9c |
---|---|
1782 b->pos = new + (r->header_in->pos - old); | 1782 b->pos = new + (r->header_in->pos - old); |
1783 b->last = new + (r->header_in->pos - old); | 1783 b->last = new + (r->header_in->pos - old); |
1784 | 1784 |
1785 r->parse_start = new; | 1785 r->parse_start = new; |
1786 | 1786 |
1787 r->header_in = b; | |
1788 | |
1789 if (r->http_version > NGX_HTTP_VERSION_11) { | |
1790 return NGX_OK; | |
1791 } | |
1792 | |
1787 if (request_line) { | 1793 if (request_line) { |
1788 r->request_start = new; | 1794 r->request_start = new; |
1789 | 1795 |
1790 if (r->request_end) { | 1796 if (r->request_end) { |
1791 r->request_end = new + (r->request_end - old); | 1797 r->request_end = new + (r->request_end - old); |
1792 } | 1798 } |
1793 | 1799 |
1794 if (r->method_start >= old && r->method_start < r->header_in->pos) { | 1800 r->method_end = new + (r->method_end - old); |
1795 r->method_start = new + (r->method_start - old); | 1801 |
1796 r->method_end = new + (r->method_end - old); | 1802 r->uri_start = new + (r->uri_start - old); |
1797 } | 1803 r->uri_end = new + (r->uri_end - old); |
1798 | 1804 |
1799 if (r->uri_start >= old && r->uri_start < r->header_in->pos) { | 1805 if (r->schema_start) { |
1800 r->uri_start = new + (r->uri_start - old); | |
1801 r->uri_end = new + (r->uri_end - old); | |
1802 } | |
1803 | |
1804 if (r->schema_start >= old && r->schema_start < r->header_in->pos) { | |
1805 r->schema_start = new + (r->schema_start - old); | 1806 r->schema_start = new + (r->schema_start - old); |
1806 r->schema_end = new + (r->schema_end - old); | 1807 r->schema_end = new + (r->schema_end - old); |
1807 } | 1808 } |
1808 | 1809 |
1809 if (r->host_start >= old && r->host_start < r->header_in->pos) { | 1810 if (r->host_start) { |
1810 r->host_start = new + (r->host_start - old); | 1811 r->host_start = new + (r->host_start - old); |
1811 if (r->host_end) { | 1812 if (r->host_end) { |
1812 r->host_end = new + (r->host_end - old); | 1813 r->host_end = new + (r->host_end - old); |
1813 } | 1814 } |
1814 } | 1815 } |
1815 | 1816 |
1816 if (r->port_start >= old && r->port_start < r->header_in->pos) { | 1817 if (r->port_start) { |
1817 r->port_start = new + (r->port_start - old); | 1818 r->port_start = new + (r->port_start - old); |
1818 r->port_end = new + (r->port_end - old); | 1819 r->port_end = new + (r->port_end - old); |
1819 } | 1820 } |
1820 | 1821 |
1821 if (r->uri_ext >= old && r->uri_ext < r->header_in->pos) { | 1822 if (r->uri_ext) { |
1822 r->uri_ext = new + (r->uri_ext - old); | 1823 r->uri_ext = new + (r->uri_ext - old); |
1823 } | 1824 } |
1824 | 1825 |
1825 if (r->args_start >= old && r->args_start < r->header_in->pos) { | 1826 if (r->args_start) { |
1826 r->args_start = new + (r->args_start - old); | 1827 r->args_start = new + (r->args_start - old); |
1827 } | 1828 } |
1828 | 1829 |
1829 if (r->http_protocol.data >= old | 1830 if (r->http_protocol.data) { |
1830 && r->http_protocol.data < r->header_in->pos) | |
1831 { | |
1832 r->http_protocol.data = new + (r->http_protocol.data - old); | 1831 r->http_protocol.data = new + (r->http_protocol.data - old); |
1833 } | 1832 } |
1834 | 1833 |
1835 } else { | 1834 } else { |
1836 if (r->header_name_start >= old | 1835 r->header_name_start = new; |
1837 && r->header_name_start < r->header_in->pos) | 1836 r->header_name_end = new + (r->header_name_end - old); |
1838 { | 1837 r->header_start = new + (r->header_start - old); |
1839 r->header_name_start = new; | 1838 r->header_end = new + (r->header_end - old); |
1840 r->header_name_end = new + (r->header_name_end - old); | 1839 } |
1841 } | |
1842 | |
1843 if (r->header_start >= old && r->header_start < r->header_in->pos) { | |
1844 r->header_start = new + (r->header_start - old); | |
1845 r->header_end = new + (r->header_end - old); | |
1846 } | |
1847 } | |
1848 | |
1849 r->header_in = b; | |
1850 | 1840 |
1851 return NGX_OK; | 1841 return NGX_OK; |
1852 } | 1842 } |
1853 | 1843 |
1854 | 1844 |