Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Net: in the absense of a request body, assume streaming it cannot fail #27192

Merged
merged 1 commit into from Jul 7, 2020
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

net: in the absense of a request body, assume streaming it cannot fail

  • Loading branch information
gterzian committed Jul 7, 2020
commit 7d4b25663f0fa4aaf7b71e4f0a594e2eeedd9175
@@ -1690,12 +1690,22 @@ fn http_network_fetch(
// The receiver will receive true if there has been an error streaming the request body.
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(
&context.state.client,
&url,
&request.method,
&mut request.headers,
request.body.as_ref().map(|body| body.take_stream()),
body,
request
.body
.as_ref()
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.