mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-02-04 10:26:01 -05:00
update to latest http-entity
This commit is contained in:
parent
87de4b4f5c
commit
b3a7795407
3
Cargo.lock
generated
3
Cargo.lock
generated
@ -184,11 +184,12 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "http-entity"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/scottlamb/http-entity#73484a16115639056549e277191b71f5e2195eeb"
|
||||
source = "git+https://github.com/scottlamb/http-entity#f581ecdb3e6bb1478f08a37d4ce48bee195c0181"
|
||||
dependencies = [
|
||||
"hyper 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"mime 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
17
src/mp4.rs
17
src/mp4.rs
@ -86,7 +86,6 @@ use error::{Error, Result};
|
||||
use http_entity;
|
||||
use hyper::header;
|
||||
use mmapfile;
|
||||
use mime;
|
||||
use openssl::hash;
|
||||
use pieces;
|
||||
use pieces::ContextWriter;
|
||||
@ -1161,9 +1160,11 @@ impl Mp4File {
|
||||
}
|
||||
|
||||
impl http_entity::Entity<Error> for Mp4File {
|
||||
fn content_type(&self) -> mime::Mime { "video/mp4".parse().unwrap() }
|
||||
fn last_modified(&self) -> &header::HttpDate { &self.last_modified }
|
||||
fn etag(&self) -> Option<&header::EntityTag> { Some(&self.etag) }
|
||||
fn add_headers(&self, hdrs: &mut header::Headers) {
|
||||
hdrs.set(header::ContentType("video/mp4".parse().unwrap()));
|
||||
}
|
||||
fn last_modified(&self) -> Option<header::HttpDate> { Some(self.last_modified) }
|
||||
fn etag(&self) -> Option<header::EntityTag> { Some(self.etag.clone()) }
|
||||
fn len(&self) -> u64 { self.slices.len() }
|
||||
fn write_to(&self, range: Range<u64>, out: &mut io::Write) -> Result<()> {
|
||||
self.slices.write_to(self, range, out)
|
||||
@ -1633,7 +1634,7 @@ mod tests {
|
||||
let sha1 = digest(&mp4);
|
||||
assert_eq!("1e5331e8371bd97ac3158b3a86494abc87cdc70e", strutil::hex(&sha1[..]));
|
||||
const EXPECTED_ETAG: &'static str = "908ae8ac303f66f2f4a1f8f52dba8f6ea9fdb442";
|
||||
assert_eq!(Some(&header::EntityTag::strong(EXPECTED_ETAG.to_owned())), mp4.etag());
|
||||
assert_eq!(Some(header::EntityTag::strong(EXPECTED_ETAG.to_owned())), mp4.etag());
|
||||
drop(db.syncer_channel);
|
||||
db.syncer_join.join().unwrap();
|
||||
}
|
||||
@ -1653,7 +1654,7 @@ mod tests {
|
||||
let sha1 = digest(&mp4);
|
||||
assert_eq!("de382684a471f178e4e3a163762711b0653bfd83", strutil::hex(&sha1[..]));
|
||||
const EXPECTED_ETAG: &'static str = "e21c6a6dfede1081db3701cc595ec267c43c2bff";
|
||||
assert_eq!(Some(&header::EntityTag::strong(EXPECTED_ETAG.to_owned())), mp4.etag());
|
||||
assert_eq!(Some(header::EntityTag::strong(EXPECTED_ETAG.to_owned())), mp4.etag());
|
||||
drop(db.syncer_channel);
|
||||
db.syncer_join.join().unwrap();
|
||||
}
|
||||
@ -1673,7 +1674,7 @@ mod tests {
|
||||
let sha1 = digest(&mp4);
|
||||
assert_eq!("685e026af44204bc9cc52115c5e17058e9fb7c70", strutil::hex(&sha1[..]));
|
||||
const EXPECTED_ETAG: &'static str = "1d5c5980f6ba08a4dd52dfd785667d42cdb16992";
|
||||
assert_eq!(Some(&header::EntityTag::strong(EXPECTED_ETAG.to_owned())), mp4.etag());
|
||||
assert_eq!(Some(header::EntityTag::strong(EXPECTED_ETAG.to_owned())), mp4.etag());
|
||||
drop(db.syncer_channel);
|
||||
db.syncer_join.join().unwrap();
|
||||
}
|
||||
@ -1693,7 +1694,7 @@ mod tests {
|
||||
let sha1 = digest(&mp4);
|
||||
assert_eq!("e0d28ddf08e24575a82657b1ce0b2da73f32fd88", strutil::hex(&sha1[..]));
|
||||
const EXPECTED_ETAG: &'static str = "555de64b39615e1a1cbe5bdd565ff197f5f126c5";
|
||||
assert_eq!(Some(&header::EntityTag::strong(EXPECTED_ETAG.to_owned())), mp4.etag());
|
||||
assert_eq!(Some(header::EntityTag::strong(EXPECTED_ETAG.to_owned())), mp4.etag());
|
||||
drop(db.syncer_channel);
|
||||
db.syncer_join.join().unwrap();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user