diff --git a/protocol/webrtc/src/http/mod.rs b/protocol/webrtc/src/http/mod.rs index 3d4e230c..6c3521e8 100644 --- a/protocol/webrtc/src/http/mod.rs +++ b/protocol/webrtc/src/http/mod.rs @@ -211,15 +211,15 @@ impl Marshal for HttpResponse { ); for (header_name, header_value) in &self.headers { - if header_name == &"Content-Length".to_string() { - if let Some(body) = &self.body { - response_str += &format!("Content-Length: {}\r\n", body.len()); - } - } else { + if header_name != &"Content-Length".to_string() { response_str += &format!("{header_name}: {header_value}\r\n"); } } + if let Some(body) = &self.body { + response_str += &format!("Content-Length: {}\r\n", body.len()); + } + response_str += "\r\n"; if let Some(body) = &self.body { response_str += body; diff --git a/protocol/webrtc/src/session/mod.rs b/protocol/webrtc/src/session/mod.rs index d52cd211..4ddf14d5 100644 --- a/protocol/webrtc/src/session/mod.rs +++ b/protocol/webrtc/src/session/mod.rs @@ -277,9 +277,6 @@ impl WebRTCServerSession { let status_code = http::StatusCode::CREATED; let mut response = Self::gen_response(status_code); - response - .headers - .insert("Connection".to_string(), "Close".to_string()); response .headers .insert("Content-Type".to_string(), "application/sdp".to_string());