Rocket

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 1a3fd1d23741cb243dc9393ec830aba22091a9d7
parent 95cbc241db6a632b060c58bd505e880db106e967
Author: Sergio Benitez <sb@sergio.bz>
Date:   Tue, 18 Sep 2018 18:25:39 -0700

Add known media types and extensions.

Adds the following to the list of known media types:

  * audio/webm (WEBA)
  * image/tiff (TIFF)
  * audio/aac (AAC)
  * text/calendar (Calendar)
  * video/mpeg (MPEG)
  * application/x-tar (TAR)
  * application/gzip (GZIP)
  * video/quicktime (MOV)
  * video/mp4 (MP4)

Also adds the following to the list of known extensions:

  * .weba (WEBA)
  * .ogv (OGG)
  * .mp4 (MP4)
  * .mpeg4 (MP4)
  * .aac (AAC)
  * .ics (Calendar)
  * .bin (Binary)
  * .mpg (MPEG)
  * .mpeg (MPEG)
  * .tar (TAR)
  * .gz (GZIP)
  * .tif (TIFF)
  * .tiff (TIFF)
  * .mov (MOV)

Diffstat:
Mcore/http/src/known_media_types.rs | 25++++++++++++++++++++++++-
Mcore/http/src/lib.rs | 2+-
Mcore/http/src/uri/uri.rs | 10+++++-----
3 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/core/http/src/known_media_types.rs b/core/http/src/known_media_types.rs @@ -20,7 +20,8 @@ macro_rules! known_media_types { SVG (is_svg): "SVG", "image", "svg+xml", Icon (is_icon): "Icon", "image", "x-icon", WEBM (is_webm): "WEBM", "video", "webm", - OGG (is_ogg): "OGG", "video", "ogg", + WEBA (is_weba): "WEBM Audio", "audio", "webm", + OGG (is_ogg): "OGG Video", "video", "ogg", FLAC (is_flac): "FLAC", "audio", "flac", WAV (is_wav): "WAV", "audio", "wav", PDF (is_pdf): "PDF", "application", "pdf", @@ -30,6 +31,14 @@ macro_rules! known_media_types { WOFF2 (is_woff2): "WOFF2", "font", "woff2", JsonApi (is_json_api): "JSON API", "application", "vnd.api+json", WASM (is_wasm): "WASM", "application", "wasm", + TIFF (is_tiff): "TIFF", "image", "tiff", + AAC (is_aac): "AAC Audio", "audio", "aac", + Calendar (is_ical): "iCalendar", "text", "calendar", + MPEG (is_mpeg): "MPEG Video", "video", "mpeg", + TAR (is_tar): "tape archive", "application", "x-tar", + GZIP (is_gzip): "gzipped binary", "application", "gzip", + MOV (is_mov): "quicktime video", "video", "quicktime", + MP4 (is_mp4): "MPEG4 Video", "video", "mp4", }) } @@ -54,13 +63,27 @@ macro_rules! known_extensions { "flac" => FLAC, "wav" => WAV, "webm" => WEBM, + "weba" => WEBA, "ogg" => OGG, + "ogv" => OGG, "pdf" => PDF, "ttf" => TTF, "otf" => OTF, "woff" => WOFF, "woff2" => WOFF2, + "mp4" => MP4, + "mpeg4" => MP4, "wasm" => WASM, + "aac" => AAC, + "ics" => Calendar, + "bin" => Binary, + "mpg" => MPEG, + "mpeg" => MPEG, + "tar" => TAR, + "gz" => GZIP, + "tif" => TIFF, + "tiff" => TIFF, + "mov" => MOV, }) } diff --git a/core/http/src/lib.rs b/core/http/src/lib.rs @@ -2,7 +2,7 @@ #![feature(proc_macro_non_items)] #![feature(try_from)] #![feature(crate_visibility_modifier)] -#![recursion_limit="256"] +#![recursion_limit="512"] //! Types that map to concepts in HTTP. //! diff --git a/core/http/src/uri/uri.rs b/core/http/src/uri/uri.rs @@ -18,11 +18,11 @@ use uri::{Origin, Authority, Absolute, Error}; /// /// Nevertheless, the `Uri` type is typically enountered as a conversion target. /// In particular, you will likely see generic bounds of the form: `T: -/// TryInto<Uri>` (for instance, in [`Redirect`](rocket::Redirect) methods). -/// This means that you can provide any type `T` that implements `TryInto<Uri>`, -/// or, equivalently, any type `U` for which `Uri` implements `TryFrom<U>` or -/// `From<U>`. These include `&str` and `String`, [`Origin`], [`Authority`], and -/// [`Absolute`]. +/// TryInto<Uri>` (for instance, in [`Redirect`](rocket::response::Redirect) +/// methods). This means that you can provide any type `T` that implements +/// `TryInto<Uri>`, or, equivalently, any type `U` for which `Uri` implements +/// `TryFrom<U>` or `From<U>`. These include `&str` and `String`, [`Origin`], +/// [`Authority`], and [`Absolute`]. /// /// ## Parsing ///