aboutsummaryrefslogtreecommitdiffstats
path: root/src/server.rs
AgeCommit message (Collapse)Author
2020-07-18server.rs: Remove canonical status name from "Status" headerTeddy Wing
This seemed to cause the name to be doubled in the final Apache HTTP header. Since it could cause that issue and is not necessary, we can remove it.
2020-07-16server.rs: Fix HTTP status code headerTeddy Wing
I was getting persistent 500 errors on Apache with mod_fastcgi: FastCGI: comm with server "/Applications/MAMP/htdocs/test.fcgi" aborted: error parsing headers: malformed header 'HTTP/1.1 200 OK' Forgot that you need to use a "Status" header for FastCGI to set the HTTP status code, like: Status: 404 This isn't an HTTP server. Apparently knew this at one point for the DomeKey web site, but completely forgot. Thanks to Ole (https://stackoverflow.com/users/312098/ole) and RichieHindle (https://stackoverflow.com/users/21886/richiehindle) on Stack Overflow for this question and answer that helped me figure it out: https://stackoverflow.com/questions/11223166/malformed-header-from-script-bad-header-http-1-1-302-found Didn't notice this previously as I was using Lighttpd for testing, and its FastCGI module must be more forgiving.
2020-07-04Add license (GNU GPLv3+)Teddy Wing
2020-07-04Server::start: Return a `Server` directly instead of a `Result`Teddy Wing
We don't have any `Result`s to propagate in this function, so the `Result` return wrapper is unnecessary. Must have copied this signature from Civet without thinking: https://github.com/conduit-rust/rust-civet/blob/ab9c52ca634f65439060c2248295d2ac354aead5/src/lib.rs#L214
2020-07-04Add documentationTeddy Wing
Write doc comments for functions and types, and include a short example.
2020-07-04server::internal_server_error: Change `match` to `unwrap_or_else`Teddy Wing
Reduce a few lines.
2020-07-04server: Log errorsTeddy Wing
Provide a mechanism to get detailed error messages when 500 internal server errors happen. We don't want to expose any detailed error information to clients, but it would be useful for administrators to know the cause of any errors.
2020-07-04server::handle_request: Wrap linesTeddy Wing
2020-07-04server: Rename `Error::WriteError` to `Error::Write` and remove contextTeddy Wing
Since we don't actually need any additional context here, we can remove it. Since that allows us to avoid calling `context()` with the `WriteError` context selector, we can then safely rename `WriteError` to `Write`.
2020-07-04server: Rename `Error::Io` to `Error::WriteError`Teddy Wing
Make this specifically about errors writing instead of a generic I/O error. Name the variant `WriteError` instead of `Write` because Snafu will generate context selector structs with these names and we already have a `Write` identifier imported.
2020-07-04Server::start: Handle errors with a 500 responseTeddy Wing
If we get errors building the request or Conduit errors, respond with a 500 error. Otherwise, it's a write error, and we should do nothing (ideally log the error), because this means the client closed the connection or there are bigger problems.
2020-06-29Rename `request::RequestError` to `request::Error`Teddy Wing
Now that we have a `request` module, the "Request" part of the name is redundant.
2020-06-29server::handle_request: Return errorsTeddy Wing
Add a new error type that we can use to collect and match errors from `handle_request()`.
2020-06-29Server::start: Extract `fastcgi::run` request handler to functionTeddy Wing
Make a separate function that can return a result to make it easier to handle errors from the handler.
2020-06-29Move `Server` code into a `server.rs` moduleTeddy Wing