Skip to content

Commit

Permalink
[feat] More clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
ppodolsky committed Apr 26, 2024
1 parent 05ed186 commit eb998fe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
15 changes: 10 additions & 5 deletions bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,20 @@ async fn blobs_get(
match state.iroh_node.read().await.blobs_get(hash).await {
Ok(Some((reader, file_size))) => match method {
Method::HEAD => Response::builder()
.header("Content-Length", file_size)
.header("Content-Type", mime_guess::mime::OCTET_STREAM.to_string())
.header(header::CONTENT_LENGTH, file_size)
.header(
header::CONTENT_TYPE,
mime_guess::mime::OCTET_STREAM.to_string(),
)
.header("X-Iroh-Hash", hash_str)
.body(Body::default())
.unwrap(),
Method::GET => Response::builder()
.header("Content-Length", file_size)
.header("Content-Type", mime_guess::mime::OCTET_STREAM.to_string())
.header(header::CONTENT_LENGTH, file_size)
.header(
header::CONTENT_TYPE,
mime_guess::mime::OCTET_STREAM.to_string(),
)
.header("X-Iroh-Hash", hash_str)
.body(Body::from_stream(ReaderStream::new(reader)))
.unwrap(),
Expand Down Expand Up @@ -575,7 +581,6 @@ async fn table_get(
let builder = Response::builder()
.status(status_code)
.header(header::ACCEPT_RANGES, "bytes")
.header(header::CACHE_CONTROL, "public,max-age=31536000,immutable")
.header(
header::CONTENT_TYPE,
mime_guess::from_ext(&key)
Expand Down
3 changes: 2 additions & 1 deletion src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use iroh::bytes::store::{ExportMode, Map};
use iroh::bytes::Hash;
use iroh::client::{Entry, LiveEvent};
use iroh::net::key::PublicKey;
use iroh::net::NodeAddr;
use iroh::net::{MagicEndpoint, NodeAddr};
use iroh::node::Node;
use iroh::rpc_protocol::{BlobDownloadRequest, DownloadMode, SetTagOption, ShareMode};
use iroh::sync::store::{DownloadPolicy, Query, SortBy, SortDirection};
Expand All @@ -32,6 +32,7 @@ use std::path::PathBuf;
use std::result;
use std::sync::Arc;
use tokio::io::AsyncRead;
use tokio_stream::StreamExt;
use tokio_task_pool::Pool;
use tokio_util::bytes;
use tokio_util::sync::CancellationToken;
Expand Down

0 comments on commit eb998fe

Please sign in to comment.