tidy
This commit is contained in:
@@ -7,8 +7,6 @@ use std::net::TcpStream;
|
||||
use std::net::ToSocketAddrs;
|
||||
use std::time::Duration;
|
||||
|
||||
#[cfg(feature = "tls")]
|
||||
use native_tls::TlsConnector;
|
||||
#[cfg(feature = "tls")]
|
||||
use native_tls::TlsStream;
|
||||
|
||||
@@ -76,7 +74,8 @@ pub fn connect_http(unit: &Unit) -> Result<Stream, Error> {
|
||||
|
||||
#[cfg(feature = "tls")]
|
||||
pub fn connect_https(unit: &Unit) -> Result<Stream, Error> {
|
||||
//
|
||||
use native_tls::TlsConnector;
|
||||
|
||||
let hostname = unit.url.host_str().unwrap();
|
||||
let port = unit.url.port().unwrap_or(443);
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ use agent::Unit;
|
||||
use error::Error;
|
||||
use header::Header;
|
||||
use std::collections::HashMap;
|
||||
use std::io::{Write, Cursor};
|
||||
use std::io::{Cursor, Write};
|
||||
use std::sync::{Arc, Mutex};
|
||||
use stream::Stream;
|
||||
|
||||
|
||||
@@ -196,12 +196,14 @@ impl Unit {
|
||||
fn match_cookies<'a>(jar: &'a CookieJar, domain: &str, path: &str, is_secure: bool) -> Vec<Header> {
|
||||
jar.iter()
|
||||
.filter(|c| {
|
||||
// if there is a domain, it must be matched. if there is no domain, then ignore cookie
|
||||
// if there is a domain, it must be matched.
|
||||
// if there is no domain, then ignore cookie
|
||||
let domain_ok = c
|
||||
.domain()
|
||||
.map(|cdom| domain.contains(cdom))
|
||||
.unwrap_or(false);
|
||||
// a path must match the beginning of request path. no cookie path, we say is ok. is it?!
|
||||
// a path must match the beginning of request path.
|
||||
// no cookie path, we say is ok. is it?!
|
||||
let path_ok = c
|
||||
.path()
|
||||
.map(|cpath| path.find(cpath).map(|pos| pos == 0).unwrap_or(false))
|
||||
|
||||
Reference in New Issue
Block a user