Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncatchable exception when trying to serve a nonexistent file. #65

Open
heegaiximephoomeeghahyaiseekh opened this issue Feb 16, 2017 · 0 comments

Comments

@heegaiximephoomeeghahyaiseekh
Copy link

(woo:run
    (lambda (env)
       `(200 (:content-type "text/html")
           #P"/file/that/does/not-exist.html")))

One would hope that this would result in a 404 error being returned to the Web client, but no. Instead, Woo attempts to open this using POSIX, and it doesn't even bother to check the return value (which is -1, with errno = 2 (ENOENT/"No such file or directory")). Instead, the error doesn't get caught until Woo calls (fd-file-size fd) with fd = -1. That invokes SBCL's binding to fstat, which properly checks for fstat's error code and signals a condition. The error comes up not in the browser, but in the Lisp debugger.

I guess I also wouldn't get a 403 error if I tried to serve a file that Woo didn't have permission to read.

The icing on the cake is that this error happens outside of the user-provided request handler, so it
goes straight to the debugger and there is no way to catch it except by modifying Woo's source
files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant