Commit Graph

100 Commits (e5d157e1afefa4b070ae6598e8a8a2902833e7ba)

Author SHA1 Message Date
_ e5d157e1af 🐛 bug: don't send Content-Length to relay if status code is 304 Not Modified
Thanks to Nginx for noticing this
2022-02-05 17:00:17 +00:00
_ 2656d16264 ♻️ refactor: extract `http_listen` fn 2022-02-05 16:52:56 +00:00
_ d96bf801c6 🔇 make logs quieter 2022-02-05 15:57:40 +00:00
_ c47ab6d282 🚧 wip: messing with cache parameters 2022-01-09 00:22:16 +00:00
_ b642142332 🐛 bug: fix content length when byte serving 2021-11-13 21:31:30 -06:00
_ 16aaac0965 🐛 bug: used the wrong PathBuf function in resolving the merge 2021-10-14 18:51:12 -05:00
_ 134035f198 Merge remote-tracking branch 'origin/main' 2021-10-14 18:35:31 -05:00
_ 98b43d1ba2 guess MIME for JavaScript files so that `ptth_file_server` can serve Jet Racing 4 locally.
Firfox has a bunch of odd security features that I only sometimes understand.
Among them is that it won't load JS files without the `content-type` header,
and it also disables a lot of features for the `file://` scheme. Which I think
is a shame. There's probably a good reason they do this, but I'm not aware of one.

So now you can use PTTH's file server to host Jet Racing 4.
2021-10-02 20:03:03 +00:00
_ 2972e85671 use rust_embed and default configs so you can call `ptth_file_server` from any working dir.
This is like Python's old `-m SimpleHTTPServer` but better because I wrote it.
2021-10-02 19:49:19 +00:00
_ f44613540e add the multi-call server
This exe can act as both a PTTH and PTTH_QUIC end server.
It's only 17 MB, which is a big improvement over the 15 + 15 for shipping both servers as their own exes
2021-10-02 18:13:14 +00:00
_ 30f8bbb0aa ♻️ refactor inject CLI args instead of reading them in main 2021-10-02 17:31:06 +00:00
_ 0b10737403 ♻️ refactor: move ptth_server's main into its library so I can make a busybox-style multi-use binary 2021-10-02 17:26:56 +00:00
_ 1abf1d194c 🚧 maybe HTTP Basic Auth? 2021-08-29 20:56:32 -05:00
_ 5376e8bba0 🚧 wip: add placeholder for client tokens 2021-08-29 20:17:25 -05:00
_ 324c1f7cd6 ♻️ refactor: remove pointless `Option <>` for file server root 2021-08-29 19:49:32 -05:00
_ 3a2147d50f use `MissedTickBehavior::Skip` on all intervals 2021-07-18 17:43:58 +00:00
_ 02b6955a50 🐛 bug: allow `auto-gen-key` to also recreate the file and fix permissions 2021-07-13 16:02:49 -05:00
_ 2f2e4ef64d 📝 document how to run `ptth_server`
This commit also works well on Termux on Android.
2021-07-11 13:12:32 +00:00
_ 6f45f5105e remove `heim` dependency
It doesn't work on Android, and I can't fault it for that (Platform difference)
but it also drags in `uom` which has a bunch of template magic that takes
forever to compile, and I'm pretty sure it's dragging down my compile times.

I tried to build `ptth_server` on nightly to get compile timings, and heim
depends on `socket2` which failed to compile.

And I never ended up using the CPU monitoring. So heim is gone now.
2021-07-11 12:17:36 +00:00
_ 5db72be1bc tell the relay our server name when we serve responses
This is needed for a future refactor of the relay.
2021-07-10 22:17:32 +00:00
_ b018f16794 ♻️ refactor: custom servers won't create a file server module. 2021-05-09 19:54:09 +00:00
_ 6c826b0cc5 ptth_server v2.1.0 will allow custom servers with a user-supplied request handler 2021-05-09 19:40:19 +00:00
_ 08009de043 🚧 it works! 2021-05-09 18:32:24 +00:00
_ c663d126aa ♻️ refactor: moving things around to support third-party ptth_server modules 2021-05-09 17:54:29 +00:00
_ 93bf38ec03 🚨 clippy pass 2021-05-02 22:32:24 +00:00
_ 810a34463c ♻️ refactor: get rid of mod.rs 2021-04-29 23:03:01 +00:00
_ 4a73f48c68 tests: fix tests 2021-04-27 14:31:32 -05:00
_ 9eb470963c make an error transparent so it's more meaningful 2021-04-18 13:51:27 -05:00
_ 2c4d46388a 📝 docs: update README before publishing to crates.io 2021-04-18 12:56:36 -05:00
_ fd238d8c2b ♻️ refactor: rename file_server::State to file_server::FileServer 2021-04-17 19:10:52 -05:00
_ ae33337156 ♻️ refactor: clean up ptth_server
- Found I was passing the file server root twice
- Removed handlebars from the public API. The templates are fixed
when ptth_server ships, so I don't think users of the lib should
care what handlebars is.
- Making other stuff private where possible
2021-04-17 18:59:59 -05:00
_ 86af3194e5 💥 breaking: remove password_is_bad from ptth_server
The password checking is not necessary with the new process of generating
high-entropy Base64 passwords and then approving them on the relay.

The password file takes a lot of space and this doesn't need to be part
of ptth_server's public API, if there is one, anyway.
2021-04-17 17:47:01 -05:00
_ d16b0c4c61 🚨 `cargo check` pass 2021-04-10 09:41:21 -05:00
_ 3408feb619 ♻️ refactor: move gen_key up to ptth_core 2021-04-09 19:43:15 -05:00
_ 240cd8dff1 ♻️ refactor: extract gen_key pure function 2021-04-09 19:30:45 -05:00
_ d9669a7073 proof of concept for private browser cache based on etag and if-none-match 2021-04-03 17:26:53 +00:00
_ 1df0f0f677 ♻️ refactor: extract stream_file 2021-04-03 16:27:31 +00:00
_ ff73f501a4 🚧 2021-04-03 16:21:59 +00:00
_ 3389292457 placeholder for caching - Always returns a random ETag header.
So the browser-side cache will always miss, but I tested that Firefox will at
least send us If-None-Match with the last ETag it saw.
2021-04-03 15:53:59 +00:00
_ 6e24983ad7 🚨 refactor: cargo clippy 2021-04-03 15:30:32 +00:00
_ 0821ccaac6 ♻️ refactor: move Markdown support in ptth_server out to a feature.
It may be removed in the future.
2021-04-03 15:17:28 +00:00
_ e5bf5f7d1f ♻️ refactor: flatten out indentation 2021-04-03 14:27:17 +00:00
_ 6ee9b6e7c9 🐛 bug: ptth_server: add 30-second timeout for _only_ http_listen requests 2021-04-02 20:58:19 -05:00
Trisha 02d4362c3b 🏁 build: fix Windows build for ptth_server 2021-03-21 14:07:09 -05:00
_ f05257d833 🐛 bug fix requests timing out after 40 seconds.
This is such a stupid bug. I swear I checked this exact piece of code for
this exact bug and it wasn't there. But after I fixed it, I had no problem
running a download for 11 hours straight.

This fix won't affect a case where the firewall is actually closing long-
running connections (which is bad behavior, but it could happen) or a case
where the Internet is just flakey and the connection drops.

But it will fix the most common case where both client and server are on
robust connections and the download times out anyway.
2021-03-21 15:43:31 +00:00
_ c1118971b0 add --throttle-upload option 2021-03-21 15:43:15 +00:00
_ 235e134cb2 ♻️ refactor: more clippy lints, and make read_git_version simpler 2021-03-21 03:45:00 +00:00
_ c6b2418a49 ♻️ refactor: split up large function at clippy's behest 2021-03-21 03:40:45 +00:00
_ 50fc509c8b 🚨 fix a bunch of easy clippy warnings 2021-03-21 03:34:47 +00:00
_ 820099c2ca ⬆️ deps: replace ulid with rusty_ulid so I can drop rand 0.6.x 2021-03-21 03:09:44 +00:00