Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
rust:
- stable
- nightly
- 1.51
- 1.57
features:
- default
- ssl
Expand Down
2 changes: 1 addition & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
msrv = "1.51"
msrv = "1.57"
4 changes: 2 additions & 2 deletions src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use std::path::Path;
use filetime;
use time;

use Request;
use Response;
use crate::Request;
use crate::Response;

/// Searches inside `path` for a file that matches the given request. If a file is found,
/// returns a `Response` that would serve this file if returned. If no file is found, a 404
Expand Down
6 changes: 3 additions & 3 deletions src/cgi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ use std::io::Read;
use std::process::Command;
use std::process::Stdio;

use Request;
use Response;
use ResponseBody;
use crate::Request;
use crate::Response;
use crate::ResponseBody;

/// Error that can happen when parsing the JSON input.
#[derive(Debug)]
Expand Down
16 changes: 8 additions & 8 deletions src/content_encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
//! content_encoding::apply(&request, response)
//! }
//! ```
use input;
use Request;
use Response;
use crate::input;
use crate::Request;
use crate::Response;

/// Applies content encoding to the response.
///
Expand Down Expand Up @@ -107,10 +107,10 @@ fn response_is_text(response: &Response) -> bool {

#[cfg(feature = "gzip")]
fn gzip(response: &mut Response) {
use crate::ResponseBody;
use deflate::deflate_bytes_gzip;
use std::io;
use std::mem;
use ResponseBody;

response
.headers
Expand All @@ -132,9 +132,9 @@ fn gzip(response: &mut Response) {}

#[cfg(feature = "brotli")]
fn brotli(response: &mut Response) {
use crate::ResponseBody;
use brotli::enc::reader::CompressorReader;
use std::mem;
use ResponseBody;

response
.headers
Expand All @@ -151,9 +151,9 @@ fn brotli(response: &mut Response) {}

#[cfg(test)]
mod tests {
use content_encoding;
use Request;
use Response;
use crate::content_encoding;
use crate::Request;
use crate::Response;

// TODO: more tests for encoding stuff
#[test]
Expand Down
2 changes: 1 addition & 1 deletion src/input/accept.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ macro_rules! accept {

#[cfg(test)]
mod tests {
use Request;
use crate::Request;

#[test]
fn basic() {
Expand Down
4 changes: 2 additions & 2 deletions src/input/basic_http_auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
//! - In order to read a plain text body, see
//! [the `plain_text_body` function](fn.plain_text_body.html).

use crate::Request;
use base64;
use Request;

/// Credentials returned by `basic_http_auth`.
#[derive(Debug, Clone, PartialEq, Eq)]
Expand Down Expand Up @@ -104,7 +104,7 @@ pub fn basic_http_auth(request: &Request) -> Option<HttpAuthCredentials> {
mod test {
use super::basic_http_auth;
use super::HttpAuthCredentials;
use Request;
use crate::Request;

#[test]
fn basic_http_auth_no_header() {
Expand Down
4 changes: 2 additions & 2 deletions src/input/cookies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
//! - In order to read a plain text body, see
//! [the `plain_text_body` function](fn.plain_text_body.html).

use crate::Request;
use std::str::Split;
use Request;

/// Attempts to parse the list of cookies from the request.
///
Expand Down Expand Up @@ -90,7 +90,7 @@ impl<'a> Iterator for CookiesIter<'a> {
#[cfg(test)]
mod test {
use super::cookies;
use Request;
use crate::Request;

#[test]
fn no_cookie() {
Expand Down
2 changes: 1 addition & 1 deletion src/input/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
//! ```
//!

use crate::Request;
use serde;
use serde_json;
use std::error;
use std::fmt;
use std::io::Error as IoError;
use Request;

/// Error that can happen when parsing the JSON input.
#[derive(Debug)]
Expand Down
4 changes: 2 additions & 2 deletions src/input/multipart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
use std::error;
use std::fmt;

use Request;
use RequestBody;
use crate::Request;
use crate::RequestBody;

use multipart::server::Multipart as InnerMultipart;

Expand Down
4 changes: 2 additions & 2 deletions src/input/plain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
// notice may not be copied, modified, or distributed except
// according to those terms.

use crate::Request;
use std::error;
use std::fmt;
use std::io::Error as IoError;
use std::io::Read;
use Request;

/// Error that can happen when parsing the request body as plain text.
#[derive(Debug)]
Expand Down Expand Up @@ -138,7 +138,7 @@ mod test {
use super::plain_text_body;
use super::plain_text_body_with_limit;
use super::PlainTextError;
use Request;
use crate::Request;

#[test]
fn ok() {
Expand Down
8 changes: 4 additions & 4 deletions src/input/post.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
//! `from_file` method. You should return `PostFieldError::WrongFieldType` if you're
//! expecting a file and `from_field` was called, or vice-versa.

use Request;
use crate::Request;

use std::borrow::Cow;
use std::error;
Expand Down Expand Up @@ -698,9 +698,9 @@ pub fn raw_urlencoded_post_input(request: &Request) -> Result<Vec<(String, Strin

#[cfg(test)]
mod tests {
use input::post::PostError;
use input::post::PostFieldError;
use Request;
use crate::input::post::PostError;
use crate::input::post::PostFieldError;
use crate::Request;

#[test]
fn basic_int() {
Expand Down
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ pub const DEFAULT_ENCODE_SET: &percent_encoding::AsciiSet = &percent_encoding::C
.add(b'{')
.add(b'}');

pub use assets::extension_to_mime;
pub use assets::match_assets;
pub use log::{log, log_custom};
pub use response::{Response, ResponseBody};
pub use crate::assets::extension_to_mime;
pub use crate::assets::match_assets;
pub use crate::log::{log, log_custom};
pub use crate::response::{Response, ResponseBody};
pub use tiny_http::ReadWrite;

use std::error::Error;
Expand Down Expand Up @@ -1062,7 +1062,7 @@ impl<'a> Read for RequestBody<'a> {

#[cfg(test)]
mod tests {
use Request;
use crate::Request;

#[test]
fn header() {
Expand Down
4 changes: 2 additions & 2 deletions src/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ use std::time::Instant;

use chrono;

use Request;
use Response;
use crate::Request;
use crate::Response;

/// Adds a log entry to the given writer for each request.
///
Expand Down
6 changes: 3 additions & 3 deletions src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ use std::net::TcpStream;
use std::net::ToSocketAddrs;
use std::time::Duration;

use Request;
use Response;
use ResponseBody;
use crate::Request;
use crate::Response;
use crate::ResponseBody;

/// Error that can happen when dispatching the request to another server.
#[derive(Debug)]
Expand Down
6 changes: 3 additions & 3 deletions src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
// notice may not be copied, modified, or distributed except
// according to those terms.

use crate::Request;
use crate::Upgrade;
use percent_encoding;
use serde;
use serde_json;
Expand All @@ -16,8 +18,6 @@ use std::fs::File;
use std::io;
use std::io::Cursor;
use std::io::Read;
use Request;
use Upgrade;

/// Contains a prototype of a response.
///
Expand Down Expand Up @@ -867,7 +867,7 @@ impl ResponseBody {

#[cfg(test)]
mod tests {
use Response;
use crate::Response;

#[test]
fn unique_header_adds() {
Expand Down
2 changes: 1 addition & 1 deletion src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ macro_rules! router {
#[allow(unused_variables)]
#[cfg(test)]
mod tests {
use Request;
use crate::Request;

// -- old-style tests --
#[test]
Expand Down
6 changes: 3 additions & 3 deletions src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ use std::borrow::Cow;
use std::sync::atomic::AtomicBool;
use std::sync::atomic::Ordering;

use input;
use Request;
use Response;
use crate::input;
use crate::Request;
use crate::Response;

pub fn session<'r, F>(request: &'r Request, cookie_name: &str, timeout_s: u64, inner: F) -> Response
where
Expand Down
4 changes: 2 additions & 2 deletions src/websocket/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ use std::fmt;
use std::sync::mpsc;
use std::vec::IntoIter as VecIntoIter;

use Request;
use Response;
use crate::Request;
use crate::Response;

mod low_level;
#[allow(clippy::module_inception)]
Expand Down
6 changes: 3 additions & 3 deletions src/websocket/websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
// notice may not be copied, modified, or distributed except
// according to those terms.

use crate::ReadWrite;
use crate::Upgrade;
use std::io;
use std::io::Write;
use std::mem;
use std::sync::mpsc::Sender;
use ReadWrite;
use Upgrade;

use websocket::low_level;
use crate::websocket::low_level;

/// A successful websocket. An open channel of communication. Implements `Read` and `Write`.
pub struct Websocket {
Expand Down