Commit 720695a
committed
sapi/was: set HTTP status 404 if opening the primary script fails
All other SAPIs detect this by doing a stat() on the primary script,
but that's a system call I'd like to avoid. It should be enough to
open() it later from within persistent_compile_file(). That however
throws a fatal error if the file could not be opened; therefore, that
function needs to be patched to avoid the fatal error when opening the
primary script, allowing the caller to handle the error condition.
Now to be able to detect whether the status has been set already,
initialize it to zero and set it in sapi_was_send_headers(). If
php_execute_script() fails and "opened_path" is still NULL, we can set
status 404 (instead of the previous 500 which was misleading).1 parent 8829e37 commit 720695a
2 files changed
+16
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2098 | 2098 | | |
2099 | 2099 | | |
2100 | 2100 | | |
2101 | | - | |
| 2101 | + | |
2102 | 2102 | | |
2103 | 2103 | | |
2104 | 2104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
174 | 177 | | |
175 | 178 | | |
176 | 179 | | |
| |||
445 | 448 | | |
446 | 449 | | |
447 | 450 | | |
448 | | - | |
| 451 | + | |
| 452 | + | |
449 | 453 | | |
450 | 454 | | |
451 | 455 | | |
| |||
456 | 460 | | |
457 | 461 | | |
458 | 462 | | |
459 | | - | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
460 | 473 | | |
461 | 474 | | |
462 | 475 | | |
| |||
0 commit comments