comparison src/http/ngx_http_script.c @ 7604:7aa20af4ac00

Rewrite: fixed segfault with rewritten URI and "alias". The "alias" directive cannot be used in the same location where URI was rewritten. This has been detected in the "rewrite ... break" case, but not when the standalone "break" directive was used. This change also fixes proxy_pass with URI component in a similar case: location /aaa/ { rewrite ^ /xxx/yyy; break; proxy_pass http://localhost:8080/bbb/; } Previously, the "/bbb/yyy" would be sent to a backend instead of "/xxx/yyy". And if location's prefix was longer than the rewritten URI, a segmentation fault might occur.
author Ruslan Ermilov <ru@nginx.com>
date Mon, 16 Dec 2019 15:19:01 +0300
parents b82162b8496a
children bdd4d89370a7
comparison
equal deleted inserted replaced
7603:e55e28e6998f 7604:7aa20af4ac00
1468 1468
1469 1469
1470 void 1470 void
1471 ngx_http_script_break_code(ngx_http_script_engine_t *e) 1471 ngx_http_script_break_code(ngx_http_script_engine_t *e)
1472 { 1472 {
1473 e->request->uri_changed = 0; 1473 ngx_http_request_t *r;
1474
1475 r = e->request;
1476
1477 if (r->uri_changed) {
1478 r->valid_location = 0;
1479 r->uri_changed = 0;
1480 }
1474 1481
1475 e->ip = ngx_http_script_exit; 1482 e->ip = ngx_http_script_exit;
1476 } 1483 }
1477 1484
1478 1485