mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Auto merge of #27192 - gterzian:no_body_no_channel, r=jdm
Net: in the absense of a request body, assume streaming it cannot fail <!-- Please describe your changes on the following line: --> FIX https://github.com/servo/servo/issues/27185 --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #___ (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
This commit is contained in:
commit
1b38197812
1 changed files with 11 additions and 1 deletions
|
@ -1690,12 +1690,22 @@ fn http_network_fetch(
|
||||||
// The receiver will receive true if there has been an error streaming the request body.
|
// The receiver will receive true if there has been an error streaming the request body.
|
||||||
let (fetch_terminated_sender, fetch_terminated_receiver) = unbounded();
|
let (fetch_terminated_sender, fetch_terminated_receiver) = unbounded();
|
||||||
|
|
||||||
|
let body = request.body.as_ref().map(|body| body.take_stream());
|
||||||
|
|
||||||
|
if body.is_none() {
|
||||||
|
// There cannot be an error streaming a non-existent body.
|
||||||
|
// However in such a case the channel will remain unused
|
||||||
|
// and drop inside `obtain_response`.
|
||||||
|
// Send the confirmation now, ensuring the receiver will not dis-connect first.
|
||||||
|
let _ = fetch_terminated_sender.send(false);
|
||||||
|
}
|
||||||
|
|
||||||
let response_future = obtain_response(
|
let response_future = obtain_response(
|
||||||
&context.state.client,
|
&context.state.client,
|
||||||
&url,
|
&url,
|
||||||
&request.method,
|
&request.method,
|
||||||
&mut request.headers,
|
&mut request.headers,
|
||||||
request.body.as_ref().map(|body| body.take_stream()),
|
body,
|
||||||
request
|
request
|
||||||
.body
|
.body
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue