Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
resolver = "2"
members = ["config", "file_server", "response"]
members = ["file_server", "response"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ The `content_encodings` and `filepath_404` properties are optional.
Bash the following command to serve files based on a an example configuration:

```sh
file_server file_server/file_server.example.json
file_server demo/demo.example.json
```

Open a browser and visit `http://localhost:3000` and an encoded version of `index.html` will be delivered.
Expand All @@ -77,8 +77,8 @@ Accept-Encoding: gzip;
And the source file has a correspponding gziped file:

```sh
./www/index.html # source file
./www/index.html.gz # gzipped file
index.html # source file
index.html.gz # gzipped file
```

`File_server` will send the encoded file, if available. Otherwise, it serves the source file.
Expand All @@ -105,6 +105,6 @@ Multipart ranges are not currently supported.

Multipart ranges are memory hogs and difficult to deliver efficiently without abusing memory resources.

## Licence
## License

`File_server` is released under the BSD 3-Clause License.
11 changes: 0 additions & 11 deletions config/Cargo.toml

This file was deleted.

6 changes: 6 additions & 0 deletions demo/demo.example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"directory": "./",
"host_and_port": "127.0.0.1:3000",
"content_encodings": ["zstd"],
"filepath_404": "./404.html"
}
6 changes: 0 additions & 6 deletions file_server.example.json

This file was deleted.

4 changes: 0 additions & 4 deletions file_server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bytes = { workspace = true}
config = { path = "../config" }
futures-util = { workspace = true}
http-body-util = { workspace = true}
hyper-util = { workspace = true}
hyper = { workspace = true}
response = { path = "../response" }
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions file_server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use std::env;
use std::path::PathBuf;
use tokio::net::TcpListener;

use config;
mod config;
mod service;

use crate::config::Config;
use config::Config;

#[tokio::main]
async fn main() -> Result<(), String> {
Expand Down
2 changes: 1 addition & 1 deletion file_server/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use hyper::Request;
use std::future::Future;
use std::pin::Pin;

use config::Config;
use crate::config::Config;
/*
BoxedResponse is a type.
It should work with hyper responses across
Expand Down
2 changes: 0 additions & 2 deletions response/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@ futures-util = { workspace = true}
http-body-util = { workspace = true}
hyper-util = { workspace = true}
hyper = { workspace = true}
serde_json = { workspace = true}
serde = { workspace = true}
tokio-util = { workspace = true}
tokio = { workspace = true}