Handling routing errors.

This commit is contained in:
Igor Sysoev
2019-05-30 15:33:51 +03:00
parent 0ba7cfce75
commit 16273cf1c6
3 changed files with 51 additions and 46 deletions

View File

@@ -295,27 +295,24 @@ nxt_http_request_pass(nxt_task_t *task, void *obj, void *data)
pass = r->conf->socket_conf->pass;
if (nxt_slow_path(pass == NULL)) {
goto fail;
if (nxt_fast_path(pass != NULL)) {
do {
nxt_debug(task, "http request route: %V", &pass->name);
pass = pass->handler(task, r, pass);
if (pass == NULL) {
return;
}
if (pass == NXT_HTTP_PASS_ERROR) {
break;
}
} while (r->pass_count++ < 255);
}
for ( ;; ) {
nxt_debug(task, "http request route: %V", &pass->name);
pass = pass->handler(task, r, pass);
if (pass == NULL) {
break;
}
if (nxt_slow_path(r->pass_count++ == 255)) {
goto fail;
}
}
return;
fail:
nxt_http_request_error(task, r, NXT_HTTP_INTERNAL_SERVER_ERROR);
}