Mercurial > hg > nginx
comparison src/http/ngx_http.c @ 9085:0af598651e33 quic
Merged with the default branch.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 29 Mar 2023 11:14:25 +0400 |
parents | c851a2ed5ce8 106328a70f4e |
children | 69bae2437d74 |
comparison
equal
deleted
inserted
replaced
9084:efd91f6afa8d | 9085:0af598651e33 |
---|---|
1128 node->inclusive = lq->inclusive; | 1128 node->inclusive = lq->inclusive; |
1129 | 1129 |
1130 node->auto_redirect = (u_char) ((lq->exact && lq->exact->auto_redirect) | 1130 node->auto_redirect = (u_char) ((lq->exact && lq->exact->auto_redirect) |
1131 || (lq->inclusive && lq->inclusive->auto_redirect)); | 1131 || (lq->inclusive && lq->inclusive->auto_redirect)); |
1132 | 1132 |
1133 node->len = (u_char) len; | 1133 node->len = (u_short) len; |
1134 ngx_memcpy(node->name, &lq->name->data[prefix], len); | 1134 ngx_memcpy(node->name, &lq->name->data[prefix], len); |
1135 | 1135 |
1136 ngx_queue_split(locations, q, &tail); | 1136 ngx_queue_split(locations, q, &tail); |
1137 | 1137 |
1138 if (ngx_queue_empty(locations)) { | 1138 if (ngx_queue_empty(locations)) { |
1230 | 1230 |
1231 static ngx_int_t | 1231 static ngx_int_t |
1232 ngx_http_add_addresses(ngx_conf_t *cf, ngx_http_core_srv_conf_t *cscf, | 1232 ngx_http_add_addresses(ngx_conf_t *cf, ngx_http_core_srv_conf_t *cscf, |
1233 ngx_http_conf_port_t *port, ngx_http_listen_opt_t *lsopt) | 1233 ngx_http_conf_port_t *port, ngx_http_listen_opt_t *lsopt) |
1234 { | 1234 { |
1235 ngx_uint_t i, default_server, proxy_protocol; | 1235 ngx_uint_t i, default_server, proxy_protocol, |
1236 protocols, protocols_prev; | |
1236 ngx_http_conf_addr_t *addr; | 1237 ngx_http_conf_addr_t *addr; |
1237 #if (NGX_HTTP_SSL) | 1238 #if (NGX_HTTP_SSL) |
1238 ngx_uint_t ssl; | 1239 ngx_uint_t ssl; |
1239 #endif | 1240 #endif |
1240 #if (NGX_HTTP_V2) | 1241 #if (NGX_HTTP_V2) |
1270 | 1271 |
1271 /* preserve default_server bit during listen options overwriting */ | 1272 /* preserve default_server bit during listen options overwriting */ |
1272 default_server = addr[i].opt.default_server; | 1273 default_server = addr[i].opt.default_server; |
1273 | 1274 |
1274 proxy_protocol = lsopt->proxy_protocol || addr[i].opt.proxy_protocol; | 1275 proxy_protocol = lsopt->proxy_protocol || addr[i].opt.proxy_protocol; |
1276 protocols = lsopt->proxy_protocol; | |
1277 protocols_prev = addr[i].opt.proxy_protocol; | |
1275 | 1278 |
1276 #if (NGX_HTTP_SSL) | 1279 #if (NGX_HTTP_SSL) |
1277 ssl = lsopt->ssl || addr[i].opt.ssl; | 1280 ssl = lsopt->ssl || addr[i].opt.ssl; |
1281 protocols |= lsopt->ssl << 1; | |
1282 protocols_prev |= addr[i].opt.ssl << 1; | |
1278 #endif | 1283 #endif |
1279 #if (NGX_HTTP_V2) | 1284 #if (NGX_HTTP_V2) |
1280 http2 = lsopt->http2 || addr[i].opt.http2; | 1285 http2 = lsopt->http2 || addr[i].opt.http2; |
1286 protocols |= lsopt->http2 << 2; | |
1287 protocols_prev |= addr[i].opt.http2 << 2; | |
1281 #endif | 1288 #endif |
1282 #if (NGX_HTTP_V3) | 1289 #if (NGX_HTTP_V3) |
1283 http3 = lsopt->http3 || addr[i].opt.http3; | 1290 http3 = lsopt->http3 || addr[i].opt.http3; |
1284 quic = lsopt->quic || addr[i].opt.quic; | 1291 quic = lsopt->quic || addr[i].opt.quic; |
1285 #endif | 1292 #endif |
1307 return NGX_ERROR; | 1314 return NGX_ERROR; |
1308 } | 1315 } |
1309 | 1316 |
1310 default_server = 1; | 1317 default_server = 1; |
1311 addr[i].default_server = cscf; | 1318 addr[i].default_server = cscf; |
1319 } | |
1320 | |
1321 /* check for conflicting protocol options */ | |
1322 | |
1323 if ((protocols | protocols_prev) != protocols_prev) { | |
1324 | |
1325 /* options added */ | |
1326 | |
1327 if ((addr[i].opt.set && !lsopt->set) | |
1328 || addr[i].protocols_changed | |
1329 || (protocols | protocols_prev) != protocols) | |
1330 { | |
1331 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, | |
1332 "protocol options redefined for %V", | |
1333 &addr[i].opt.addr_text); | |
1334 } | |
1335 | |
1336 addr[i].protocols = protocols_prev; | |
1337 addr[i].protocols_set = 1; | |
1338 addr[i].protocols_changed = 1; | |
1339 | |
1340 } else if ((protocols_prev | protocols) != protocols) { | |
1341 | |
1342 /* options removed */ | |
1343 | |
1344 if (lsopt->set | |
1345 || (addr[i].protocols_set && protocols != addr[i].protocols)) | |
1346 { | |
1347 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, | |
1348 "protocol options redefined for %V", | |
1349 &addr[i].opt.addr_text); | |
1350 } | |
1351 | |
1352 addr[i].protocols = protocols; | |
1353 addr[i].protocols_set = 1; | |
1354 addr[i].protocols_changed = 1; | |
1355 | |
1356 } else { | |
1357 | |
1358 /* the same options */ | |
1359 | |
1360 if ((lsopt->set && addr[i].protocols_changed) | |
1361 || (addr[i].protocols_set && protocols != addr[i].protocols)) | |
1362 { | |
1363 ngx_conf_log_error(NGX_LOG_WARN, cf, 0, | |
1364 "protocol options redefined for %V", | |
1365 &addr[i].opt.addr_text); | |
1366 } | |
1367 | |
1368 addr[i].protocols = protocols; | |
1369 addr[i].protocols_set = 1; | |
1312 } | 1370 } |
1313 | 1371 |
1314 addr[i].opt.default_server = default_server; | 1372 addr[i].opt.default_server = default_server; |
1315 addr[i].opt.proxy_protocol = proxy_protocol; | 1373 addr[i].opt.proxy_protocol = proxy_protocol; |
1316 #if (NGX_HTTP_SSL) | 1374 #if (NGX_HTTP_SSL) |
1369 if (addr == NULL) { | 1427 if (addr == NULL) { |
1370 return NGX_ERROR; | 1428 return NGX_ERROR; |
1371 } | 1429 } |
1372 | 1430 |
1373 addr->opt = *lsopt; | 1431 addr->opt = *lsopt; |
1432 addr->protocols = 0; | |
1433 addr->protocols_set = 0; | |
1434 addr->protocols_changed = 0; | |
1374 addr->hash.buckets = NULL; | 1435 addr->hash.buckets = NULL; |
1375 addr->hash.size = 0; | 1436 addr->hash.size = 0; |
1376 addr->wc_head = NULL; | 1437 addr->wc_head = NULL; |
1377 addr->wc_tail = NULL; | 1438 addr->wc_tail = NULL; |
1378 #if (NGX_PCRE) | 1439 #if (NGX_PCRE) |