From 47986d8e0f159e307be314963a0f2e44f560a43c Mon Sep 17 00:00:00 2001
From: Pierre Krieger
Received:
- ") + ").into() }, (GET) (/ws) => { @@ -73,7 +73,7 @@ fn main() { }, // Default 404 route as with all examples. - _ => rouille::Response::empty_404() + _ => rouille::Response::empty_404().into() ) }); } diff --git a/src/assets.rs b/src/assets.rs index aa6f74d86..14f3c6692 100644 --- a/src/assets.rs +++ b/src/assets.rs @@ -15,6 +15,7 @@ use time; use Request; use Response; +use ResponseCacheControl; use ResponseBody; /// Searches inside `path` for a file that matches the given request. If a file is found, @@ -128,24 +129,24 @@ pub fn match_assetsAn internal error has occurred on the server.
") .with_status_code(500) + .into() } } }; @@ -278,7 +281,7 @@ pub fn start_server(addr: A, handler: F) -> ! .with_data(res_data, res_len); for (key, value) in rouille_response.headers { - if let Ok(header) = tiny_http::Header::from_bytes(key, value) { + if let Ok(header) = tiny_http::Header::from_bytes(&*key, &*value) { response.add_header(header); } else { // TODO: ? @@ -430,7 +433,7 @@ impl Request { /// /// fn handle(request: &Request) -> Response { /// if !request.is_secure() { - /// return Response::redirect(&format!("https://example.com")); + /// return Response::redirect(format!("https://example.com")); /// } /// /// // ... diff --git a/src/log.rs b/src/log.rs index 4cb7b7c73..010c55ddc 100644 --- a/src/log.rs +++ b/src/log.rs @@ -15,7 +15,7 @@ use std::time::Instant; use chrono; use Request; -use Response; +use RawResponse; /// Adds a log entry to the given writer at each request. /// @@ -26,17 +26,18 @@ use Response; /// /// ``` /// use std::io; -/// use rouille::{Request, Response}; +/// use rouille::{Request, Response, RawResponse}; /// -/// fn handle(request: &Request) -> Response { +/// fn handle(request: &Request) -> RawResponse { /// rouille::log(request, io::stdout(), || { /// Response::text("hello world") /// }) /// } /// ``` -pub fn log