mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
net: don't set content-length in obtain response
This commit is contained in:
parent
48d4aec5b6
commit
ca686313ee
1 changed files with 1 additions and 14 deletions
|
@ -407,8 +407,6 @@ fn obtain_response(
|
||||||
method: &Method,
|
method: &Method,
|
||||||
request_headers: &HeaderMap,
|
request_headers: &HeaderMap,
|
||||||
body: Option<IpcSender<BodyChunkRequest>>,
|
body: Option<IpcSender<BodyChunkRequest>>,
|
||||||
request_len: Option<usize>,
|
|
||||||
load_data_method: &Method,
|
|
||||||
pipeline_id: &Option<PipelineId>,
|
pipeline_id: &Option<PipelineId>,
|
||||||
request_id: Option<&str>,
|
request_id: Option<&str>,
|
||||||
is_xhr: bool,
|
is_xhr: bool,
|
||||||
|
@ -419,7 +417,7 @@ fn obtain_response(
|
||||||
Error = NetworkError,
|
Error = NetworkError,
|
||||||
>,
|
>,
|
||||||
> {
|
> {
|
||||||
let mut headers = request_headers.clone();
|
let headers = request_headers.clone();
|
||||||
|
|
||||||
let devtools_bytes = StdArc::new(Mutex::new(vec![]));
|
let devtools_bytes = StdArc::new(Mutex::new(vec![]));
|
||||||
|
|
||||||
|
@ -428,12 +426,6 @@ fn obtain_response(
|
||||||
// TODO: If body is a stream, append `Transfer-Encoding`/`chunked`,
|
// TODO: If body is a stream, append `Transfer-Encoding`/`chunked`,
|
||||||
// see step 4.2 of https://fetch.spec.whatwg.org/#concept-http-network-fetch
|
// see step 4.2 of https://fetch.spec.whatwg.org/#concept-http-network-fetch
|
||||||
|
|
||||||
// Step 5.6 of https://fetch.spec.whatwg.org/#concept-http-network-or-cache-fetch
|
|
||||||
// If source is non-null,
|
|
||||||
// set contentLengthValue to httpRequest’s body’s total bytes
|
|
||||||
if let Some(request_len) = request_len {
|
|
||||||
headers.typed_insert(ContentLength(request_len as u64));
|
|
||||||
}
|
|
||||||
let (body_chan, body_port) = ipc::channel().unwrap();
|
let (body_chan, body_port) = ipc::channel().unwrap();
|
||||||
|
|
||||||
let (sender, receiver) = channel(1);
|
let (sender, receiver) = channel(1);
|
||||||
|
@ -474,9 +466,6 @@ fn obtain_response(
|
||||||
receiver
|
receiver
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
if *load_data_method != Method::GET && *load_data_method != Method::HEAD {
|
|
||||||
headers.typed_insert(ContentLength(0))
|
|
||||||
}
|
|
||||||
let (_sender, mut receiver) = channel(1);
|
let (_sender, mut receiver) = channel(1);
|
||||||
|
|
||||||
receiver.close();
|
receiver.close();
|
||||||
|
@ -1575,8 +1564,6 @@ fn http_network_fetch(
|
||||||
&request.method,
|
&request.method,
|
||||||
&request.headers,
|
&request.headers,
|
||||||
request.body.as_mut().and_then(|body| body.take_stream()),
|
request.body.as_mut().and_then(|body| body.take_stream()),
|
||||||
request.body.as_ref().and_then(|body| body.len()),
|
|
||||||
&request.method,
|
|
||||||
&request.pipeline_id,
|
&request.pipeline_id,
|
||||||
request_id.as_ref().map(Deref::deref),
|
request_id.as_ref().map(Deref::deref),
|
||||||
is_xhr,
|
is_xhr,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue