comparison src/http/ngx_http.c @ 8481:0d2b2664b41c quic

QUIC: added "quic" listen parameter. The parameter allows processing HTTP/0.9-2 over QUIC. Also, introduced ngx_http_quic_module and moved QUIC settings there
author Roman Arutyunyan <arut@nginx.com>
date Tue, 21 Jul 2020 23:09:22 +0300
parents 001ec7fce567
children 13f7085b90d2
comparison
equal deleted inserted replaced
8480:f537f99b86ee 8481:0d2b2664b41c
1198 ngx_uint_t i, default_server, proxy_protocol; 1198 ngx_uint_t i, default_server, proxy_protocol;
1199 ngx_http_conf_addr_t *addr; 1199 ngx_http_conf_addr_t *addr;
1200 #if (NGX_HTTP_SSL) 1200 #if (NGX_HTTP_SSL)
1201 ngx_uint_t ssl; 1201 ngx_uint_t ssl;
1202 #endif 1202 #endif
1203 #if (NGX_HTTP_QUIC)
1204 ngx_uint_t quic;
1205 #endif
1203 #if (NGX_HTTP_V2) 1206 #if (NGX_HTTP_V2)
1204 ngx_uint_t http2; 1207 ngx_uint_t http2;
1205 #endif 1208 #endif
1206 #if (NGX_HTTP_SSL) 1209 #if (NGX_HTTP_V3)
1207 ngx_uint_t http3; 1210 ngx_uint_t http3;
1208 #endif 1211 #endif
1209 1212
1210 /* 1213 /*
1211 * we cannot compare whole sockaddr struct's as kernel 1214 * we cannot compare whole sockaddr struct's as kernel
1236 proxy_protocol = lsopt->proxy_protocol || addr[i].opt.proxy_protocol; 1239 proxy_protocol = lsopt->proxy_protocol || addr[i].opt.proxy_protocol;
1237 1240
1238 #if (NGX_HTTP_SSL) 1241 #if (NGX_HTTP_SSL)
1239 ssl = lsopt->ssl || addr[i].opt.ssl; 1242 ssl = lsopt->ssl || addr[i].opt.ssl;
1240 #endif 1243 #endif
1244 #if (NGX_HTTP_QUIC)
1245 quic = lsopt->quic || addr[i].opt.quic;
1246 #endif
1241 #if (NGX_HTTP_V2) 1247 #if (NGX_HTTP_V2)
1242 http2 = lsopt->http2 || addr[i].opt.http2; 1248 http2 = lsopt->http2 || addr[i].opt.http2;
1243 #endif 1249 #endif
1244 #if (NGX_HTTP_SSL) 1250 #if (NGX_HTTP_V3)
1245 http3 = lsopt->http3 || addr[i].opt.http3; 1251 http3 = lsopt->http3 || addr[i].opt.http3;
1246 #endif 1252 #endif
1247 1253
1248 if (lsopt->set) { 1254 if (lsopt->set) {
1249 1255
1275 addr[i].opt.default_server = default_server; 1281 addr[i].opt.default_server = default_server;
1276 addr[i].opt.proxy_protocol = proxy_protocol; 1282 addr[i].opt.proxy_protocol = proxy_protocol;
1277 #if (NGX_HTTP_SSL) 1283 #if (NGX_HTTP_SSL)
1278 addr[i].opt.ssl = ssl; 1284 addr[i].opt.ssl = ssl;
1279 #endif 1285 #endif
1286 #if (NGX_HTTP_QUIC)
1287 addr[i].opt.quic = quic;
1288 #endif
1280 #if (NGX_HTTP_V2) 1289 #if (NGX_HTTP_V2)
1281 addr[i].opt.http2 = http2; 1290 addr[i].opt.http2 = http2;
1282 #endif 1291 #endif
1283 #if (NGX_HTTP_SSL) 1292 #if (NGX_HTTP_V3)
1284 addr[i].opt.http3 = http3; 1293 addr[i].opt.http3 = http3;
1285 #endif 1294 #endif
1286 1295
1287 return NGX_OK; 1296 return NGX_OK;
1288 } 1297 }
1324 &lsopt->addr_text); 1333 &lsopt->addr_text);
1325 } 1334 }
1326 1335
1327 #endif 1336 #endif
1328 1337
1329 #if (NGX_HTTP_SSL && !defined NGX_OPENSSL_QUIC) 1338 #if (NGX_HTTP_QUIC && !defined NGX_OPENSSL_QUIC)
1330 1339
1331 if (lsopt->http3) { 1340 if (lsopt->quic) {
1332 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, 1341 ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
1333 "nginx was built with OpenSSL that lacks QUIC " 1342 "nginx was built with OpenSSL that lacks QUIC "
1334 "support, HTTP/3 is not enabled for %V", 1343 "support, QUIC is not enabled for %V",
1335 &lsopt->addr_text); 1344 &lsopt->addr_text);
1336 } 1345 }
1337 1346
1338 #endif 1347 #endif
1339 1348
1795 ls->reuseport = addr->opt.reuseport; 1804 ls->reuseport = addr->opt.reuseport;
1796 #endif 1805 #endif
1797 1806
1798 ls->wildcard = addr->opt.wildcard; 1807 ls->wildcard = addr->opt.wildcard;
1799 1808
1800 #if (NGX_HTTP_SSL) 1809 #if (NGX_HTTP_QUIC)
1801 ls->quic = addr->opt.http3; 1810 ls->quic = addr->opt.quic;
1802 #endif 1811 #endif
1803 1812
1804 return ls; 1813 return ls;
1805 } 1814 }
1806 1815
1828 addrs[i].addr = sin->sin_addr.s_addr; 1837 addrs[i].addr = sin->sin_addr.s_addr;
1829 addrs[i].conf.default_server = addr[i].default_server; 1838 addrs[i].conf.default_server = addr[i].default_server;
1830 #if (NGX_HTTP_SSL) 1839 #if (NGX_HTTP_SSL)
1831 addrs[i].conf.ssl = addr[i].opt.ssl; 1840 addrs[i].conf.ssl = addr[i].opt.ssl;
1832 #endif 1841 #endif
1842 #if (NGX_HTTP_QUIC)
1843 addrs[i].conf.quic = addr[i].opt.quic;
1844 #endif
1833 #if (NGX_HTTP_V2) 1845 #if (NGX_HTTP_V2)
1834 addrs[i].conf.http2 = addr[i].opt.http2; 1846 addrs[i].conf.http2 = addr[i].opt.http2;
1835 #endif 1847 #endif
1836 #if (NGX_HTTP_SSL) 1848 #if (NGX_HTTP_V3)
1837 addrs[i].conf.http3 = addr[i].opt.http3; 1849 addrs[i].conf.http3 = addr[i].opt.http3;
1838 #endif 1850 #endif
1839 addrs[i].conf.proxy_protocol = addr[i].opt.proxy_protocol; 1851 addrs[i].conf.proxy_protocol = addr[i].opt.proxy_protocol;
1840 1852
1841 if (addr[i].hash.buckets == NULL 1853 if (addr[i].hash.buckets == NULL
1896 addrs6[i].addr6 = sin6->sin6_addr; 1908 addrs6[i].addr6 = sin6->sin6_addr;
1897 addrs6[i].conf.default_server = addr[i].default_server; 1909 addrs6[i].conf.default_server = addr[i].default_server;
1898 #if (NGX_HTTP_SSL) 1910 #if (NGX_HTTP_SSL)
1899 addrs6[i].conf.ssl = addr[i].opt.ssl; 1911 addrs6[i].conf.ssl = addr[i].opt.ssl;
1900 #endif 1912 #endif
1913 #if (NGX_HTTP_QUIC)
1914 addrs6[i].conf.quic = addr[i].opt.quic;
1915 #endif
1901 #if (NGX_HTTP_V2) 1916 #if (NGX_HTTP_V2)
1902 addrs6[i].conf.http2 = addr[i].opt.http2; 1917 addrs6[i].conf.http2 = addr[i].opt.http2;
1903 #endif 1918 #endif
1904 #if (NGX_HTTP_SSL) 1919 #if (NGX_HTTP_V3)
1905 addrs6[i].conf.http3 = addr[i].opt.http3; 1920 addrs6[i].conf.http3 = addr[i].opt.http3;
1906 #endif 1921 #endif
1907 addrs6[i].conf.proxy_protocol = addr[i].opt.proxy_protocol; 1922 addrs6[i].conf.proxy_protocol = addr[i].opt.proxy_protocol;
1908 1923
1909 if (addr[i].hash.buckets == NULL 1924 if (addr[i].hash.buckets == NULL