Damjan Georgievski
1a12b3aa30
canonicalized root directory is now also an App state
...
- used to setup the StaticFiles handler
- also for the .tar file handler
additionally, PathBuf::from_param is used to forbid certain paths, see:
https://actix.rs/api/actix-web/stable/actix_web/dev/trait.FromParam.html
2018-07-22 05:39:32 +02:00
Damjan Georgievski
8a86739f14
don't overwrite RUST_LOG if it exists
2018-07-22 03:53:39 +02:00
Damjan Georgievski
e56cf130fe
strip binaries for release deploys
2018-07-21 22:17:19 +02:00
Damjan Georgievski
dfe3f18f21
let's try making releases via travis
...
supports both mac os x and linux
2018-07-21 21:28:16 +02:00
Damjan Georgievski
06e5cd47eb
this can be expressed in a single filter_map
2018-07-21 21:27:57 +02:00
Damjan Georgievski
a9c0e1ec81
use r#" "# string literals so to not escape the "
2018-07-21 20:27:03 +02:00
Damjan Georgievski
ac3627179f
insignificant changes
...
still experimenting with *my* rust style
2018-07-21 20:22:40 +02:00
Damjan Georgievski
a3a95e66c3
also chdir to destination directory
2018-07-21 20:13:14 +02:00
Damjan Georgievski
6ad16f8dcf
r.get() is a shortcut for r.method(Method::GET)
2018-07-21 20:01:28 +02:00
Damjan Georgievski
15704d04e7
version 0.5
...
note how to build releases
2018-07-21 19:32:04 +02:00
Damjan Georgievski
9373a1cb9c
upercase PORT in usage
2018-07-21 19:31:43 +02:00
Damjan Georgievski
e707d1a05e
log shared directory
2018-07-21 19:12:59 +02:00
Damjan Georgievski
38434ddaf1
actix-web supports content-encoding:gzip by default
...
data will be compressed on the wire automatically, so no need to add the complexity of compression
2018-07-21 18:42:54 +02:00
Damjan Georgievski
0967442fcd
add a favicon
...
- fixes #6
- the image is embeded in the executable with the include_bytes! macro
- I choose a simple share image
2018-07-21 18:41:02 +02:00
Damjan Georgievski
e400d6e1d3
implement cli arguments with clap
...
* add clap dependency https://docs.rs/clap/
* updated README with the real USAGE
* the web App now takes a directory to server files from
2018-07-21 17:45:24 +02:00
Damjan Georgievski
933b53b2b1
remove the println! since the logger already prints the listener
2018-07-21 15:14:01 +02:00
Damjan Georgievski
091f203317
use a non default logger that doesn't log the timestamp
...
the env_logger already adds the timestamp, so it was redundant
before:
`INFO 2018-07-21T12:57:49Z: actix_web::middleware::logger: 127.0.0.1:42112 [21/Jul/2018:14:57:49 +0200] "GET / HTTP/1.1" 200 858 "-" "curl/7.61.0" 0.000686`
after:
`INFO 2018-07-21T13:03:20Z: actix_web::middleware::logger: 127.0.0.1:42154 "GET / HTTP/1.1" 200 858 "-" "curl/7.61.0" 0.000367`
2018-07-21 15:13:30 +02:00
Damjan Georgievski
a6a3d707d6
implement a default logger
...
I've snuck some renames of variables too
2018-07-21 14:59:47 +02:00
Damjan Georgievski
a4d895ea4a
bump to the axtix-web 0.7 release
2018-07-21 14:39:29 +02:00
Дамјан Георгиевски
c91c994c8c
actix_web reexports actix
...
Re-export actix::prelude::* as actix_web::actix module.
So no need to explicitly import it or add it in Cargo.toml
2018-07-19 20:03:17 +02:00
Дамјан Георгиевски
ca4cc0a941
actix 0.7 has been released, no need to patch the dependency
2018-07-15 18:59:49 +02:00
Дамјан Георгиевски
e8d3481108
the size is not bytes but objects
...
and objects were byte arrays (typically 8KB).
limit it to 64, so typically not more than 512kb is used. doesn't change
the max speed when downloading on localhost, and decreases the RSS usage
with slow clients.
2018-07-13 09:48:42 +02:00
Дамјан Георгиевски
9a56bcb1a0
slight reorganization of the html generation
2018-07-08 16:11:19 +02:00
Дамјан Георгиевски
e9ef0d582e
insignificant changes
...
* renamed `run_tar_in_thread()` to `stream_tar_in_thread()`
* use `impl Responder` instead of `Result<HttpResponse>`
* add an `.unwrap()` to `StaticFiles::new()` (seems to be an upstream API change)
2018-07-08 16:07:32 +02:00
Дамјан Георгиевски
803ffc0c99
use futures::sync::mpsc::channel() with 4MB buffer
...
… instead of unbounded() with no limits in buffering
this should implement a back pressure, when the client can't read the
response fast enough, the thread creating the archive would block the
write, instead of filling the memory.
Use Sink::wait() to make a blocking Sender
2018-07-07 23:49:46 +02:00
Дамјан Георгиевски
62a99f8dc3
use just last part of pathname in the tar
...
Previously:
```
$ curl -s http://localhost:8000/target/release/build.tar -o - | tar tf -
target/release/build/rayon-core-b8ae11d289218da3
…
```
Now:
```
$ curl -s http://localhost:8000/target/release/build.tar -o - | tar tf -
build/rayon-core-b8ae11d289218da3
…
```
2018-07-07 23:47:35 +02:00
Дамјан Георгиевски
de0040512b
try to build smaller --release binaries
2018-07-05 18:04:11 +02:00
Дамјан Георгиевски
17a40e188a
forgot the second point
2018-07-05 17:57:12 +02:00
Дамјан Георгиевски
fd46bfb55a
refactor: split code in multiple files
...
… main.rs is now small enough to add cli args
2018-07-05 17:48:40 +02:00
Дамјан Георгиевски
b8f4607dba
fancier dir list template
2018-07-05 10:55:22 +02:00
Дамјан Георгиевски
591587649c
sort directories first, and then alphabetically by filename
2018-07-04 23:41:54 +02:00
Дамјан Георгиевски
a8fef98041
charset=utf-8
2018-07-04 23:31:02 +02:00
Дамјан Георгиевски
95adb78666
double quotes for html attribute values
2018-07-04 23:30:37 +02:00
Дамјан Георгиевски
46ffbeaa6e
implement streaming of a folder as a tar
2018-07-04 23:14:05 +02:00
Дамјан Георгиевски
b5533e1428
implement custom directory listing
2018-07-04 23:13:32 +02:00
Дамјан Георгиевски
27eec3f434
added some new dependencies
2018-07-04 23:11:57 +02:00
Дамјан Георгиевски
7845a4e3d7
first skeleton
2018-07-04 14:03:30 +02:00
Дамјан Георгиевски
7cd907b78d
initial idea commited
2018-07-04 13:57:42 +02:00