Repository: servo/servo
File: components/net/http_loader.rs (Rust)

Code before:
                    websocket_chan.receiver.take().unwrap(),
                )
            };

            let mut tls_config = create_tls_config(
                context.ca_certificates.clone(),
                context.ignore_certificate_errors,
                context.state.override_manager.clone(),
            );
            tls_config.alpn_protocols = vec!["http/1.1".to_string().into()];

            let response = match start_websocket(
                context.state.clone(),
                resource_event_sender,
                protocols,
                request,
                tls_config,
                dom_action_receiver,
            )
            .await
            {
                Ok(response) => response,
                Err(err) => {
                    return Response::network_error(NetworkError::WebsocketConnectionFailure(
                        format!("{:?}", err),
                    ));
                },
            };

            let response = response.map(|r| match r {
                Some(body) => Full::from(body).map_err(|_| unreachable!()).boxed(),
                None => http_body_util::Empty::new()
                    .map_err(|_| unreachable!())
                    .boxed(),
            });
            (Decoder::detect(response, url.is_secure_scheme()), None)
        },
        _ => {
            let response_future = obtain_response(
                &context.state.client,
                &url,
                &request.method,
                &mut request.headers,
                body,
                request
                    .body
                    .as_ref()
                    .is_some_and(|body| body.source_is_null()),
                &request.pipeline_id,
                Some(&request_id),
                request.destination,

Review comment (bug):
Nit (apologies that this is not a suggestion, the GitHub interface has been busted recently):

```rust
                Err(error) => {
                    return Response::network_error(NetworkError::WebsocketConnectionFailure(
                        format!("{error:?}"),
                    ));
```

Code after:
                    websocket_chan.receiver.take().unwrap(),
                )
            };

            let mut tls_config = create_tls_config(
                context.ca_certificates.clone(),
                context.ignore_certificate_errors,
                context.state.override_manager.clone(),
            );
            tls_config.alpn_protocols = vec!["http/1.1".to_string().into()];

            let response = match start_websocket(
                context.state.clone(),
                resource_event_sender,
                protocols,
                request,
                tls_config,
                dom_action_receiver,
            )
            .await
            {
                Ok(response) => response,
                Err(error) => {
                    return Response::network_error(NetworkError::WebsocketConnectionFailure(
                        format!("{error:?}"),
                    ));
                },
            };

            let response = response.map(|r| match r {
                Some(body) => Full::from(body).map_err(|_| unreachable!()).boxed(),
                None => http_body_util::Empty::new()
                    .map_err(|_| unreachable!())
                    .boxed(),
            });
            (Decoder::detect(response, url.is_secure_scheme()), None)
        },
        _ => {
            let response_future = obtain_response(
                &context.state.client,
                &url,
                &request.method,
                &mut request.headers,
                body,
                request
                    .body
                    .as_ref()
                    .is_some_and(|body| body.source_is_null()),
                &request.pipeline_id,
                Some(&request_id),
                request.destination,