mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Remove outdated HTTP redirection handling code.
This commit is contained in:
parent
2b28042446
commit
4a1732a761
1 changed files with 3 additions and 27 deletions
|
@ -360,11 +360,9 @@ fn obtain_response(
|
||||||
client: &Client<Connector, Body>,
|
client: &Client<Connector, Body>,
|
||||||
url: &ServoUrl,
|
url: &ServoUrl,
|
||||||
method: &Method,
|
method: &Method,
|
||||||
request_headers: &HeaderMap,
|
headers: &HeaderMap,
|
||||||
data: &Option<Vec<u8>>,
|
data: &Option<Vec<u8>>,
|
||||||
load_data_method: &Method,
|
|
||||||
pipeline_id: &Option<PipelineId>,
|
pipeline_id: &Option<PipelineId>,
|
||||||
iters: u32,
|
|
||||||
request_id: Option<&str>,
|
request_id: Option<&str>,
|
||||||
is_xhr: bool,
|
is_xhr: bool,
|
||||||
context: &FetchContext,
|
context: &FetchContext,
|
||||||
|
@ -374,28 +372,7 @@ fn obtain_response(
|
||||||
Error = NetworkError,
|
Error = NetworkError,
|
||||||
>,
|
>,
|
||||||
> {
|
> {
|
||||||
let mut headers = request_headers.clone();
|
let request_body = data.as_ref().cloned().unwrap_or(vec![]);
|
||||||
|
|
||||||
// Avoid automatically sending request body if a redirect has occurred.
|
|
||||||
//
|
|
||||||
// TODO - This is the wrong behaviour according to the RFC. However, I'm not
|
|
||||||
// sure how much "correctness" vs. real-world is important in this case.
|
|
||||||
//
|
|
||||||
// https://tools.ietf.org/html/rfc7231#section-6.4
|
|
||||||
let is_redirected_request = iters != 1;
|
|
||||||
let request_body;
|
|
||||||
match data {
|
|
||||||
&Some(ref d) if !is_redirected_request => {
|
|
||||||
headers.typed_insert(ContentLength(d.len() as u64));
|
|
||||||
request_body = d.clone();
|
|
||||||
},
|
|
||||||
_ => {
|
|
||||||
if *load_data_method != Method::GET && *load_data_method != Method::HEAD {
|
|
||||||
headers.typed_insert(ContentLength(0))
|
|
||||||
}
|
|
||||||
request_body = vec![];
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
context
|
context
|
||||||
.timing
|
.timing
|
||||||
|
@ -455,6 +432,7 @@ fn obtain_response(
|
||||||
let method = method.clone();
|
let method = method.clone();
|
||||||
let send_start = precise_time_ms();
|
let send_start = precise_time_ms();
|
||||||
|
|
||||||
|
let headers = headers.clone();
|
||||||
Box::new(
|
Box::new(
|
||||||
client
|
client
|
||||||
.request(request)
|
.request(request)
|
||||||
|
@ -1413,9 +1391,7 @@ fn http_network_fetch(
|
||||||
&request.method,
|
&request.method,
|
||||||
&request.headers,
|
&request.headers,
|
||||||
&request.body,
|
&request.body,
|
||||||
&request.method,
|
|
||||||
&request.pipeline_id,
|
&request.pipeline_id,
|
||||||
request.redirect_count + 1,
|
|
||||||
request_id.as_ref().map(Deref::deref),
|
request_id.as_ref().map(Deref::deref),
|
||||||
is_xhr,
|
is_xhr,
|
||||||
context,
|
context,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue