Skip to content

Commit

Permalink
Bump dependencies
Browse files Browse the repository at this point in the history
Don't bump serde* to 1.0 because rfsapi depends on 0.9 and I don't feel
like doing a three-way cross-update right now :v
  • Loading branch information
nabijaczleweli committed Oct 1, 2017
1 parent fa7ed73 commit 4810a17
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
13 changes: 7 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@ lazy_static = "0.2"
serde_json = "0.9"
mime_guess = "1.8"
lazysort = "0.1"
brotli2 = "0.2"
unicase = "1.4"
base64 = "0.5"
brotli2 = "0.3"
unicase = "2.0"
base64 = "0.7"
flate2 = "0.2"
rfsapi = "0.1"
bzip2 = "0.3"
ctrlc = "3.0"
serde = "0.9"
clap = "2.23"
clap = "2.26"
time = "0.1"
url = "1.4"
md6 = "1.1"
url = "1.5"
md6 = "2.0"

[dependencies.trivial_colours]
version = "0.3"
Expand All @@ -47,5 +47,6 @@ embed-resource = "1.1"

[[bin]]
name = "http"
path = "src/main.rs"
test = false
doc = false
2 changes: 1 addition & 1 deletion src/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ impl HttpHandler {

let flen = req_p.metadata().expect("Failed to get requested file metadata").len();
if self.encoded_temp_dir.is_some() && flen > MIN_ENCODING_SIZE && flen < MAX_ENCODING_SIZE &&
req_p.extension().and_then(|s| s.to_str()).map(|s| !BLACKLISTED_ENCODING_EXTENSIONS.contains(&UniCase(s))).unwrap_or(true) {
req_p.extension().and_then(|s| s.to_str()).map(|s| !BLACKLISTED_ENCODING_EXTENSIONS.contains(&UniCase::new(s))).unwrap_or(true) {
self.handle_get_file_encoded(req, req_p, mime_type)
} else {
Ok(Response::with((status::Ok,
Expand Down
4 changes: 2 additions & 2 deletions src/util/content_encoding.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use brotli2::stream::{CompressMode as BrotliCompressMode, CompressParams as BrotliCompressParams};
use brotli2::{CompressMode as BrotliCompressMode, CompressParams as BrotliCompressParams};
use flate2::write::{DeflateEncoder, GzEncoder};
use flate2::Compression as Flate2Compression;
use iron::headers::{QualityItem, Encoding};
Expand All @@ -23,7 +23,7 @@ lazy_static! {
/// The list of extensions not to encode.
pub static ref BLACKLISTED_ENCODING_EXTENSIONS: BTreeSet<UniCase<&'static str>> = {
let raw = include_str!("../../assets/encoding_blacklist");
raw.split('\n').map(str::trim).filter(|s| !s.is_empty() && !s.starts_with('#')).map(UniCase).collect()
raw.split('\n').map(str::trim).filter(|s| !s.is_empty() && !s.starts_with('#')).map(UniCase::new).collect()
};
}

Expand Down
18 changes: 10 additions & 8 deletions src/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

mod content_encoding;

use base64;
use std::f64;
use std::cmp;
use std::fs::File;
Expand All @@ -16,6 +15,7 @@ use std::collections::HashMap;
use time::{self, Duration, Tm};
use iron::{mime, Headers, Url};
use std::io::{BufReader, BufRead};
use base64::display::Base64Display;
use mime_guess::{guess_mime_type_opt, get_mime_type_str};

pub use self::content_encoding::*;
Expand All @@ -35,31 +35,33 @@ lazy_static! {
pub static ref ASSETS: HashMap<&'static str, Cow<'static, str>> = {
let mut ass = HashMap::with_capacity(10);
ass.insert("favicon",
Cow::Owned(format!("data:{};base64,{}", get_mime_type_str("ico").unwrap(), base64::encode(&include_bytes!("../../assets/favicon.ico")[..]))));
Cow::Owned(format!("data:{};base64,{}",
get_mime_type_str("ico").unwrap(),
Base64Display::standard(&include_bytes!("../../assets/favicon.ico")[..]))));
ass.insert("dir_icon",
Cow::Owned(format!("data:{};base64,{}",
get_mime_type_str("gif").unwrap(),
base64::encode(&include_bytes!("../../assets/icons/directory_icon.gif")[..]))));
Base64Display::standard(&include_bytes!("../../assets/icons/directory_icon.gif")[..]))));
ass.insert("file_icon",
Cow::Owned(format!("data:{};base64,{}",
get_mime_type_str("gif").unwrap(),
base64::encode(&include_bytes!("../../assets/icons/file_icon.gif")[..]))));
Base64Display::standard(&include_bytes!("../../assets/icons/file_icon.gif")[..]))));
ass.insert("file_binary_icon",
Cow::Owned(format!("data:{};base64,{}",
get_mime_type_str("gif").unwrap(),
base64::encode(&include_bytes!("../../assets/icons/file_binary_icon.gif")[..]))));
Base64Display::standard(&include_bytes!("../../assets/icons/file_binary_icon.gif")[..]))));
ass.insert("file_image_icon",
Cow::Owned(format!("data:{};base64,{}",
get_mime_type_str("gif").unwrap(),
base64::encode(&include_bytes!("../../assets/icons/file_image_icon.gif")[..]))));
Base64Display::standard(&include_bytes!("../../assets/icons/file_image_icon.gif")[..]))));
ass.insert("file_text_icon",
Cow::Owned(format!("data:{};base64,{}",
get_mime_type_str("gif").unwrap(),
base64::encode(&include_bytes!("../../assets/icons/file_text_icon.gif")[..]))));
Base64Display::standard(&include_bytes!("../../assets/icons/file_text_icon.gif")[..]))));
ass.insert("back_arrow_icon",
Cow::Owned(format!("data:{};base64,{}",
get_mime_type_str("gif").unwrap(),
base64::encode(&include_bytes!("../../assets/icons/back_arrow_icon.gif")[..]))));
Base64Display::standard(&include_bytes!("../../assets/icons/back_arrow_icon.gif")[..]))));
ass.insert("date", Cow::Borrowed(include_str!("../../assets/date.js")));
ass.insert("upload", Cow::Borrowed(include_str!("../../assets/upload.js")));
ass.insert("adjust_tz", Cow::Borrowed(include_str!("../../assets/adjust_tz.js")));
Expand Down

0 comments on commit 4810a17

Please sign in to comment.