diff options
author | Sean McArthur <sean.monstar@gmail.com> | 2014-11-14 11:57:32 -0800 |
---|---|---|
committer | Manish Goregaokar <manishsmail@gmail.com> | 2014-12-04 10:06:39 -0800 |
commit | 12727d4dd0a93c7ab8139c8ae6893a1ec3b5edaf (patch) | |
tree | 31cbc8e8cfbbf7e95b6c9878f9589eaf63add8d1 /components/net/fetch/request.rs | |
parent | 92a8c7a80ccd5721884da96dbd28c6c40ba32b70 (diff) | |
download | servo-12727d4dd0a93c7ab8139c8ae6893a1ec3b5edaf.tar.gz servo-12727d4dd0a93c7ab8139c8ae6893a1ec3b5edaf.zip |
convert net crate to use hyper
Diffstat (limited to 'components/net/fetch/request.rs')
-rw-r--r-- | components/net/fetch/request.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/components/net/fetch/request.rs b/components/net/fetch/request.rs index 95bdc76ca35..aa53337516b 100644 --- a/components/net/fetch/request.rs +++ b/components/net/fetch/request.rs @@ -3,8 +3,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use url::Url; -use http::method::{Get, Method}; -use http::headers::request::HeaderCollection; +use hyper::method::{Get, Method}; +use hyper::mime::{Mime, Text, Html, Charset, Utf8}; +use hyper::header::Headers; +use hyper::header::common::ContentType; use fetch::cors_cache::CORSCache; use fetch::response::Response; @@ -58,7 +60,7 @@ pub enum ResponseTainting { pub struct Request { pub method: Method, pub url: Url, - pub headers: HeaderCollection, + pub headers: Headers, pub unsafe_request: bool, pub body: Option<Vec<u8>>, pub preserve_content_codings: bool, @@ -87,7 +89,7 @@ impl Request { Request { method: Get, url: url, - headers: HeaderCollection::new(), + headers: Headers::new(), unsafe_request: false, body: None, preserve_content_codings: false, @@ -116,7 +118,7 @@ impl Request { "about" => match self.url.non_relative_scheme_data() { Some(s) if s.as_slice() == "blank" => { let mut response = Response::new(); - let _ = response.headers.insert_raw("Content-Type".to_string(), b"text/html;charset=utf-8"); + response.headers.set(ContentType(Mime(Text, Html, vec![(Charset, Utf8)]))); response }, _ => Response::network_error() |