Turns out I left some hardcoded values in the main branch when pushed the code as 0.1.0 initial release.
@@ 81,7 83,7 @@ impl GeminiServer { if !parsed_url .host_str() .unwrap_or_default() - .contains("localhost") + .contains(&self.hostname) { return crate::proxy::handle_proxy(url).await; }
That's clearly wrong as if we have a capsule with "my-capsule.net" hostname that's served by gabbo, with internal link like "./some-page.gmi". This would lead the server to believe we're trying to access a url with proxy.
There's nothing wrong with it on itself, but the proxy is half-baked yet and it'd look like that actually:
1. Handle TLS handshake with the client
2. Access the capsule and append the page name to the hostname
3. Then wrongly assume we're proxying and try to access that page anyway
4. Fail tremendously as we'd be accessing ourselves, but this time without proper TLS because it's not yet implemented for proxy.
On the client side that looks as just "TLS handshake error", and with a error like that we can't even send the error code properly as we don't have an established connection to do so.
So we're just left with a blank page on the client and some cryptic message in logs. Gladly, RUST_LOG=trace helps that case as it becomes clear that we're accessing ourselves and how it fails.
I also cut off some dependencies to make the server binary lighter. After all, 6+ mbytes for feature-incomplete gemini server is a bit crazy :)
After carefully inspecting cargo-tree output I found that there was "rustls" dependency already re-exported by "futures_rustls", so I don't need to add it as a whole new dep. And now it's down to just ~4-ish megabytes.
And we can even archive it 4x if there's a need:
byte@mac gabbro % upx --best --lzma --force-macos target/release/gabbro Ultimate Packer for eXecutables Copyright (C) 1996 - 2024 UPX 4.2.4 Markus Oberhumer, Laszlo Molnar & John Reiser May 9th 2024 File size Ratio Format Name -------------------- ------ ----------- ----------- 3584048 -> 1146896 32.00% macho/arm64 gabbro Packed 1 file. byte@mac gabbro % lsd -lah /target/release ... .rwxr-xr-x byte 1.1 MB Mon Jan 27 22:49:09 2025 gabbro ...
Byte, signing off 👋