index : static-web-server.git

ascending towards madness

author Jose Quintana <joseluisquintana20@gmail.com> 2019-11-28 11:13:28.0 +00:00:00
committer Jose Quintana <joseluisquintana20@gmail.com> 2019-11-28 11:16:58.0 +00:00:00
commit
94feaae56fb0f58f179cbfa6f5cd71cb2fff96cc [patch]
tree
a5b6805fa7334f156b76259b12414f23b75ad00b
parent
91ae15fc690e2f8913ee2695208f3926e7e5c2f6
download
94feaae56fb0f58f179cbfa6f5cd71cb2fff96cc.tar.gz

Prepare 1.0.0-beta.4 (#7)



Diff

 .travis.yml        |  33 +++++++++++-
 Cargo.lock         | 155 ++++++++++++++++++++++++++++--------------------------
 Cargo.toml         |  13 ++---
 README.md          |  38 ++++---------
 src/env.rs         |   4 +-
 src/main.rs        |  42 +++------------
 src/staticfiles.rs |  25 +++++++++-
 7 files changed, 171 insertions(+), 139 deletions(-)

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..a351ccc
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,33 @@
language: rust
sudo: required
dist: trusty
addons:
  apt:
    packages:
      - libssl-dev
env:
  - PATH=$HOME/.cargo/bin:$PATH
script:
  - cargo test -j2 --all
matrix:
  fast_finish: true
  include:
    - rust: stable
    # Run rustfmt in its own shard.
    - rust: stable
      env:
        - SHARD=rustfmt
      before_script:
        - rustup component add --toolchain stable rustfmt-preview
      script:
        - echo "Checking project codebase with rustfmt release `cargo fmt --version`."
        - cargo fmt --all -- --check
    # Run Clippy in its own shard.
    - rust: stable
      env:
        - SHARD=clippy
      before_script:
        - rustup component add --toolchain stable clippy
      script:
        - echo "Checking project codebase with Clippy release `cargo clippy --version`."
        - cargo clippy --all --profile test
diff --git a/Cargo.lock b/Cargo.lock
index b08be7a..be5b020 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -18,13 +18,13 @@ name = "atty"
version = "0.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
 "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "autocfg"
version = "0.1.6"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
@@ -33,12 +33,12 @@ version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
 "safemem 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
 "safemem 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "bitflags"
version = "1.2.0"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
@@ -53,12 +53,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "chrono"
version = "0.4.9"
version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
 "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
 "num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
 "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
]

@@ -67,7 +66,7 @@ name = "cloudabi"
version = "0.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
@@ -90,7 +89,7 @@ dependencies = [

[[package]]
name = "env_logger"
version = "0.5.13"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -102,21 +101,21 @@ dependencies = [

[[package]]
name = "envy"
version = "0.3.3"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
 "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "flate2"
version = "1.0.12"
version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
 "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 "miniz_oxide 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
 "miniz_oxide 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
@@ -125,6 +124,14 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "hermit-abi"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "httparse"
version = "1.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -147,7 +154,7 @@ dependencies = [
 "language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
 "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
 "mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
 "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
 "traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -162,7 +169,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
 "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
 "unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
 "unicode-normalization 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
@@ -174,7 +181,7 @@ dependencies = [
 "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
 "mime_guess 1.8.7 (registry+https://github.com/rust-lang/crates.io-index)",
 "modifier 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "plugin 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
 "typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
 "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -192,7 +199,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "libc"
version = "0.2.62"
version = "0.2.65"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
@@ -221,7 +228,7 @@ name = "memchr"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
@@ -250,7 +257,7 @@ dependencies = [

[[package]]
name = "miniz_oxide"
version = "0.3.3"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -266,24 +273,25 @@ name = "num-integer"
version = "0.1.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
 "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
 "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
 "num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "num-traits"
version = "0.2.8"
version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
 "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "num_cpus"
version = "1.10.1"
version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 "hermit-abi 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
@@ -329,7 +337,7 @@ dependencies = [
[[package]]
name = "playground-middleware"
version = "0.1.0"
source = "git+https://github.com/integer32llc/playground-middleware.git#146df5e79210fc21ded487cf41fcb4e1ae1a347a"
source = "git+https://github.com/joseluisq/iron-playground-middleware.git#146df5e79210fc21ded487cf41fcb4e1ae1a347a"
dependencies = [
 "csv 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "iron 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -351,7 +359,7 @@ dependencies = [

[[package]]
name = "proc-macro2"
version = "1.0.5"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -367,7 +375,7 @@ name = "quote"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
 "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
@@ -375,8 +383,8 @@ name = "rand"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
 "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
 "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -393,7 +401,7 @@ name = "rand_chacha"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
 "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
 "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
]

@@ -431,7 +439,7 @@ name = "rand_jitter"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
 "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
 "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -443,7 +451,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
 "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
 "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
 "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -454,7 +462,7 @@ name = "rand_pcg"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
 "autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
 "rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
]

@@ -502,22 +510,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "safemem"
version = "0.3.2"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "serde"
version = "1.0.101"
version = "1.0.103"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "serde_derive 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "serde_derive"
version = "1.0.101"
version = "1.0.103"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
 "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
 "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
 "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
@@ -527,30 +538,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "smallvec"
version = "0.6.10"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "static-web-server"
version = "1.0.0-beta.3"
version = "1.0.0-beta.1"
dependencies = [
 "chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
 "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
 "envy 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
 "flate2 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)",
 "chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
 "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "envy 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "flate2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)",
 "iron 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
 "playground-middleware 0.1.0 (git+https://github.com/integer32llc/playground-middleware.git)",
 "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
 "serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
 "playground-middleware 0.1.0 (git+https://github.com/joseluisq/iron-playground-middleware.git)",
 "serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
name = "syn"
version = "1.0.5"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
 "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
 "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
 "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -576,7 +586,7 @@ name = "time"
version = "0.1.42"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
 "redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)",
 "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -617,10 +627,10 @@ dependencies = [

[[package]]
name = "unicode-normalization"
version = "0.1.8"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
 "smallvec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
]

[[package]]
@@ -691,19 +701,20 @@ dependencies = [
"checksum adler32 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2"
"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d"
"checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90"
"checksum autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "b671c8fb71b457dd4ae18c4ba1e59aa81793daacc361d82fcd410cef0d491875"
"checksum autocfg 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2"
"checksum base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643"
"checksum bitflags 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8a606a02debe2813760609f57a64a2ffd27d9fdf5b2f133eaca0b248dd92cdd2"
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
"checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5"
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
"checksum chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e8493056968583b0193c1bb04d6f7684586f3726992d6c573261941a895dbd68"
"checksum chrono 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "31850b4a4d6bae316f7a09e691c944c28299298837edc0a03f755618c23cbc01"
"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
"checksum csv 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7ef22b37c7a51c564a365892c012dc0271221fdcc64c69b19ba4d6fa8bd96d9c"
"checksum env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)" = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38"
"checksum envy 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "20664407d5097b5a861dffb0c32af2be7215a0050415cb50232aec36d73f69df"
"checksum flate2 1.0.12 (registry+https://github.com/rust-lang/crates.io-index)" = "ad3c5233c9a940c8719031b423d7e6c16af66e031cb0420b0896f5245bf181d3"
"checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
"checksum envy 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "261b836bcf13f42a01c70351f56bd7b66db6e6fb58352bd214cb77e9269a34b4"
"checksum flate2 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6bd6d6f4752952feb71363cffc9ebac9411b75b87c6ab6058c40c8900cf43c0f"
"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
"checksum hermit-abi 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "307c3c9f937f38e3534b1d6447ecf090cafcc9744e4a6360e8b037b2cf5af120"
"checksum httparse 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9"
"checksum humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
"checksum hyper 0.10.16 (registry+https://github.com/rust-lang/crates.io-index)" = "0a0652d9a2609a968c14be1a9ea00bf4b1d64e2e1f53a1b51b6fff3a6e829273"
@@ -711,7 +722,7 @@ dependencies = [
"checksum iron 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c6d308ca2d884650a8bf9ed2ff4cb13fbb2207b71f64cda11dc9b892067295e8"
"checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a"
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
"checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba"
"checksum libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "1a31a0627fdf1f6a39ec0dd577e101440b7db22672c0901fe00a9a6fbb5c24e8"
"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
@@ -719,19 +730,19 @@ dependencies = [
"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
"checksum mime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ba626b8a6de5da682e1caa06bdb42a335aee5a84db8e5046a3e8ab17ba0a3ae0"
"checksum mime_guess 1.8.7 (registry+https://github.com/rust-lang/crates.io-index)" = "0d977de9ee851a0b16e932979515c0f3da82403183879811bc97d50bd9cc50f7"
"checksum miniz_oxide 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "304f66c19be2afa56530fa7c39796192eef38618da8d19df725ad7c6d6b2aaae"
"checksum miniz_oxide 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6f3f74f726ae935c3f514300cc6773a0c9492abc5e972d42ba0c0ebb88757625"
"checksum modifier 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "41f5c9112cb662acd3b204077e0de5bc66305fa8df65c8019d5adb10e9ab6e58"
"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09"
"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32"
"checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273"
"checksum num-traits 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c81ffc11c212fa327657cb19dd85eb7419e163b5b076bede2bdb5c974c07e4"
"checksum num_cpus 1.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "76dac5ed2a876980778b8b85f75a71b6cbf0db0b1232ee12f826bccb00d09d72"
"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
"checksum phf 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "b3da44b85f8e8dfaec21adae67f95d93244b2ecf6ad2a692320598dcc8e6dd18"
"checksum phf_codegen 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "b03e85129e324ad4166b06b2c7491ae27fe3ec353af72e72cd1654c7225d517e"
"checksum phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "09364cc93c159b8b06b1f4dd8a4398984503483891b0c26b867cf431fb132662"
"checksum phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "234f71a15de2288bcb7e3b6515828d22af7ec8598ee6d24c3b526fa0a80b67a0"
"checksum playground-middleware 0.1.0 (git+https://github.com/integer32llc/playground-middleware.git)" = "<none>"
"checksum playground-middleware 0.1.0 (git+https://github.com/joseluisq/iron-playground-middleware.git)" = "<none>"
"checksum plugin 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "1a6a0dc3910bc8db877ffed8e457763b317cf880df4ae19109b9f77d277cf6e0"
"checksum proc-macro2 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "90cf5f418035b98e655e9cdb225047638296b862b42411c4e45bb88d700f7fc0"
"checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27"
"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
"checksum rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca"
@@ -749,12 +760,12 @@ dependencies = [
"checksum regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dc220bd33bdce8f093101afe22a037b8eb0e5af33592e6a9caafff0d4cb81cbd"
"checksum regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716"
"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"
"checksum safemem 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d2b08423011dae9a5ca23f07cf57dac3857f5c885d352b76f6d95f4aea9434d0"
"checksum serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)" = "9796c9b7ba2ffe7a9ce53c2287dfc48080f4b2b362fcc245a259b3a7201119dd"
"checksum serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)" = "4b133a43a1ecd55d4086bd5b4dc6c1751c68b1bfbeba7a5040442022c7e7c02e"
"checksum safemem 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072"
"checksum serde 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)" = "1217f97ab8e8904b57dd22eb61cde455fa7446a9c1cf43966066da047c1f3702"
"checksum serde_derive 1.0.103 (registry+https://github.com/rust-lang/crates.io-index)" = "a8c6faef9a2e64b0064f48570289b4bf8823b7581f1d6157c1b52152306651d0"
"checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac"
"checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7"
"checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf"
"checksum smallvec 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ecf3b85f68e8abaa7555aa5abdb1153079387e60b718283d732f03897fcfc86"
"checksum syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "661641ea2aa15845cddeb97dad000d22070bb5c1fb456b96c1cba883ec691e92"
"checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e"
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
@@ -763,7 +774,7 @@ dependencies = [
"checksum typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "653be63c80a3296da5551e1bfd2cca35227e13cdd08c6668903ae2f4f77aa1f6"
"checksum unicase 1.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7f4765f83163b74f957c797ad9253caf97f103fb064d3999aea9568d09fc8a33"
"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
"checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426"
"checksum unicode-normalization 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b561e267b2326bb4cebfc0ef9e68355c7abe6c6f522aeac2f5bf95d56c59bdcf"
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
"checksum unsafe-any 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f30360d7979f5e9c6e6cea48af192ea8fab4afb3cf72597154b8f08935bc9c7f"
"checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a"
diff --git a/Cargo.toml b/Cargo.toml
index ba28168..615ceba 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,17 +1,16 @@
[package]
name = "static-web-server"
version = "1.0.0-beta.3"
version = "1.0.0-beta.1"
authors = ["Jose Quintana <https://git.io/joseluisq>"]

[dependencies]
iron = ">= 0.5, < 0.7"
iron = "0.6"
log = "0.4"
chrono = "0.4"
env_logger = "0.5"
playground-middleware = { git = "https://github.com/integer32llc/playground-middleware.git" }
envy = "0.3"
serde = "1.0"
serde_derive = "1.0"
env_logger = "0.7"
playground-middleware = { git = "https://github.com/joseluisq/iron-playground-middleware.git" }
envy = "0.4"
serde = { version = "1.0", features = ["derive"] }
flate2 = "1.0"

[profile.release]
diff --git a/README.md b/README.md
index 456d70e..20a1b20 100644
--- a/README.md
+++ b/README.md
@@ -1,24 +1,26 @@
# Static Web Server [![Build Status]https://ci.joseluisq.net/api/badges/joseluisq/static-web-server/status.svg?branch=develop]https://ci.joseluisq.net/joseluisq/static-web-server [![]https://images.microbadger.com/badges/image/joseluisq/static-web-server.svg]https://microbadger.com/images/joseluisq/static-web-server "Get your own image badge on microbadger.com"
# Static Web Server [![Build Status]https://travis-ci.com/joseluisq/static-web-server.svg?branch=master]https://travis-ci.com/joseluisq/static-web-server [![]https://images.microbadger.com/badges/image/joseluisq/static-web-server.svg]https://microbadger.com/images/joseluisq/static-web-server "Get your own image badge on microbadger.com" [![Docker Image]https://img.shields.io/docker/pulls/joseluisq/static-web-server.svg?maxAge=2592000]https://hub.docker.com/r/joseluisq/static-web-server/

> A fast web server to static files-serving powered by [Rust Iron]https://github.com/iron/iron. :zap:
> A blazing fast static files-serving web server powered by [Rust Iron]https://github.com/iron/iron. :zap:

**Static Web Server** is an small (`1,6M` static binary) and fast web server to serving static files. Which is also suitable to deploy it into a Docker container.
**Static Web Server** is a small (`1,6M` static binary) and fast web server to serving static files like html files or assets.

__Status:__ The status is WIP so feel free to contribute.
It's also an option to deploy it inside a [Docker container]https://hub.docker.com/r/joseluisq/static-web-server.

__Status:__ It's in beta yet. Feel free to contribute.

## Usage

Server is configurated via environment variables:
Server is configured via environment variables:

- **SERVER_NAME**: Name for server. Default `nameless`.
- **SERVER_NAME**: Name for server. Default `my-static-server`.
- **SERVER_HOST**: Host address (E.g 127.0.0.1). Default `[::]`.
- **SERVER_PORT**: Host port. Default `80`.
- **SERVER_ROOT**: Root directory path of static files. Default `/public`.
- **SERVER_ASSETS**: Assets directory path for add cache headers functionality. Default `/public/assets`.
- **SERVER_ROOT**: Root directory path of static files. Default `./public`.
- **SERVER_ASSETS**: Assets directory path for add cache headers functionality. Default `./assets` but relative to the root.

## Docker stack

Example using Traefik proxy
Example using [Traefik proxy]https://traefik.io/:

```yaml
version: "3.3"
@@ -29,7 +31,7 @@ services:
    environment:
        - SERVER_NAME=my-server
        - SERVER_HOST=127.0.0.1
        - SERVER_PORT=80
        - SERVER_PORT=8080
        - SERVER_ROOT=/html
        - SERVER_ASSETS=./assets
    volumes:
@@ -48,22 +50,6 @@ networks:
        external: true
```

## Development

```sh
~> make help

Static Web Server
Web Server to static files-serving.

Please use `make <target>` where <target> is one of:
    install           to install dependencies.
    run               to run server in development.
    watch             to run server (watch files mode) in development.
    release           to build a release.
    docker_image      to build a Docker image.
```

## Contributions

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in current work by you, as defined in the Apache-2.0 license, shall be dual licensed as described below, without any additional terms or conditions.
diff --git a/src/env.rs b/src/env.rs
index 5e582ca..92532b5 100644
--- a/src/env.rs
+++ b/src/env.rs
@@ -1,3 +1,5 @@
use serde::Deserialize;

#[derive(Deserialize, Debug)]
pub struct Config {
    #[serde(default = "default_name")]
@@ -13,7 +15,7 @@ pub struct Config {
}

pub fn default_name() -> String {
    "nameless".to_string()
    "my-static-server".to_string()
}

pub fn default_host() -> String {
diff --git a/src/main.rs b/src/main.rs
index 07c353e..b22d54a 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,8 +1,3 @@
#[macro_use]
extern crate log;
#[macro_use]
extern crate serde_derive;

extern crate chrono;
extern crate env_logger;
extern crate envy;
@@ -11,22 +6,20 @@ extern crate iron;
extern crate playground_middleware;
extern crate serde;

#[macro_use]
extern crate log;

use crate::env::Config;
use chrono::Local;
use env_logger::Builder;
use iron::prelude::*;
use log::LevelFilter;
use playground_middleware::{Cache, GuessContentType, ModifyWith, Prefix, Staticfile};
use std::io::Write;
use std::time::Duration;

#[macro_use]
mod gzip;
mod env;
mod gzip;
mod logger;

use crate::env::Config;
use crate::gzip::GzipMiddleware;
use crate::logger::Logger;
mod staticfiles;

fn main() {
    Builder::new()
@@ -44,9 +37,7 @@ fn main() {

    let config = envy::prefixed("SERVER_")
        .from_env::<Config>()
        .expect("Unable to parsing config from env");

    // headers.append_raw("server", config.name.as_bytes().to_vec());
        .expect("Unable to parsing the configuration from system env");

    let _address = &format!(
        "{}{}{}",
@@ -55,24 +46,9 @@ fn main() {
        config.port.to_string()
    );

    let files = Staticfile::new(config.root).expect("Directory to serve not found");
    let mut files = Chain::new(files);

    let one_day = Duration::new(60 * 60 * 24, 0);
    let one_year = Duration::new(60 * 60 * 24 * 365, 0);
    let default_content_type = "text/html"
        .parse()
        .expect("Unable to create default content type");

    files.link_after(ModifyWith::new(Cache::new(one_day)));
    files.link_after(Prefix::new(&[config.assets], Cache::new(one_year)));
    files.link_after(GuessContentType::new(default_content_type));
    files.link_after(GzipMiddleware);
    files.link_after(Logger);

    let _server = Iron::new(files)
    let _server = Iron::new(staticfiles::handler(config.root, config.assets))
        .http(_address)
        .expect("Unable to start server");
        .expect("Unable to start the HTTP Server");

    info!("HTTP Server `{}` is running on {}", config.name, _address);
}
diff --git a/src/staticfiles.rs b/src/staticfiles.rs
new file mode 100644
index 0000000..3bcde31
--- /dev/null
+++ b/src/staticfiles.rs
@@ -0,0 +1,25 @@
use crate::gzip::GzipMiddleware;
use crate::logger::Logger;

use iron::prelude::*;
use playground_middleware::{Cache, GuessContentType, ModifyWith, Prefix, Staticfile};
use std::time::Duration;

pub fn handler(root_dir: String, assets_dir: String) -> Chain {
    let mut files =
        Chain::new(Staticfile::new(root_dir).expect("Directory to serve files was not found"));

    let one_day = Duration::new(60 * 60 * 24, 0);
    let one_year = Duration::new(60 * 60 * 24 * 365, 0);
    let default_content_type = "text/html"
        .parse()
        .expect("Unable to create a default content type header");

    files.link_after(ModifyWith::new(Cache::new(one_day)));
    files.link_after(Prefix::new(&[assets_dir], Cache::new(one_year)));
    files.link_after(GuessContentType::new(default_content_type));
    files.link_after(GzipMiddleware);
    files.link_after(Logger);

    files
}