mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Ensure STS headers are only honoured when they come from an HTTPS host
This commit is contained in:
parent
c44579018a
commit
0d94ee917d
1 changed files with 18 additions and 17 deletions
|
@ -15,8 +15,7 @@ use std::collections::HashSet;
|
|||
use file_loader;
|
||||
use flate2::read::{DeflateDecoder, GzDecoder};
|
||||
use hyper::client::Request;
|
||||
use hyper::header::{AcceptEncoding, Accept, ContentLength, ContentType, Host, Location, qitem};
|
||||
use hyper::header::{Quality, QualityItem};
|
||||
use hyper::header::{AcceptEncoding, Accept, ContentLength, ContentType, Host, Location, qitem, Quality, QualityItem};
|
||||
use hyper::header::StrictTransportSecurity;
|
||||
use hyper::Error as HttpError;
|
||||
use hyper::method::Method;
|
||||
|
@ -299,6 +298,7 @@ reason: \"certificate verify failed\" }]))";
|
|||
}
|
||||
}
|
||||
|
||||
if url.scheme == "https" {
|
||||
if let Some(header) = response.headers.get::<StrictTransportSecurity>() {
|
||||
if let Some(host) = url.domain() {
|
||||
info!("adding host {} to the strict transport security list", host);
|
||||
|
@ -318,6 +318,7 @@ reason: \"certificate verify failed\" }]))";
|
|||
).unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if response.status.class() == StatusClass::Redirection {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue