Fix Gemini protocol status codes and error handling
- Path security violations now return 51 (Not Found) instead of 59 (Bad Request) - Timeouts return 41 (Server Unavailable) per Gemini spec - Add comprehensive request validation: empty requests, oversized requests (>1024 bytes), malformed URLs - Fix CLI argument conflict (config -c vs cert -c) - Update documentation with status codes, error handling guidelines, and lint checking - Add environment setup instructions for clippy and cargo PATH
This commit is contained in:
parent
2347c04211
commit
9d29321806
5 changed files with 166 additions and 62 deletions
23
README.md
23
README.md
|
|
@ -22,9 +22,9 @@ Create a config file at `/etc/pollux/config.toml` or use `--config` to specify a
|
|||
|
||||
```toml
|
||||
root = "/path/to/static/files"
|
||||
cert = "certs/cert.pem"
|
||||
key = "certs/key.pem"
|
||||
host = "gemini.jeena.net"
|
||||
cert = "/path/to/cert.pem"
|
||||
key = "/path/to/key.pem"
|
||||
host = "gemini.example.com"
|
||||
port = 1965
|
||||
log_level = "info"
|
||||
```
|
||||
|
|
@ -33,10 +33,10 @@ log_level = "info"
|
|||
|
||||
### Quick Start with Self-Signed Certs
|
||||
```bash
|
||||
mkdir -p dev
|
||||
mkdir -p tmp
|
||||
openssl req -x509 -newkey rsa:2048 \
|
||||
-keyout dev/key.pem \
|
||||
-out dev/cert.pem \
|
||||
-keyout tmp/key.pem \
|
||||
-out tmp/cert.pem \
|
||||
-days 365 \
|
||||
-nodes \
|
||||
-subj "/CN=localhost"
|
||||
|
|
@ -44,8 +44,8 @@ openssl req -x509 -newkey rsa:2048 \
|
|||
|
||||
Update `config.toml`:
|
||||
```toml
|
||||
cert = "dev/cert.pem"
|
||||
key = "dev/key.pem"
|
||||
cert = "tmp/cert.pem"
|
||||
key = "tmp/key.pem"
|
||||
```
|
||||
|
||||
Run the server:
|
||||
|
|
@ -77,15 +77,12 @@ Access with a Gemini client like Lagrange at `gemini://yourdomain.com/`.
|
|||
- `--host`: Hostname for validation (required)
|
||||
- `--port`: Port to listen on (default 1965)
|
||||
|
||||
## Security
|
||||
|
||||
Uses path validation to prevent directory traversal. Validate hostnames for production use.
|
||||
|
||||
### Certificate Management
|
||||
|
||||
- Never commit certificate files to version control
|
||||
- Use development certificates only for local testing
|
||||
- Production certificates should be obtained via Let's Encrypt or your CA
|
||||
|
||||
## Testing
|
||||
|
||||
Run `cargo test` for unit tests. Fix warnings before commits.
|
||||
Run `cargo test` for unit tests. Fix warnings before commits.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue