fix(http): reject unsupported codecs with 415 and the codec as body

This commit is contained in:
2026-08-08 13:42:08 +01:00
parent aa1d4e8f67
commit 7d9b3b6285
4 changed files with 35 additions and 31 deletions
+4 -7
View File
@@ -63,7 +63,7 @@ pub struct ServerInfo {
pub struct HttpServer {
pub offer_tx: Sender<(i32, i32, String)>,
pub accept_rx: async_broadcast::InactiveReceiver<(i32, Option<String>)>,
pub accept_rx: async_broadcast::InactiveReceiver<(i32, Result<String, String>)>,
pub appstate: Arc<Mutex<AppState>>,
pub request_count: AtomicI32,
pub db: DatabaseConnection,
@@ -456,18 +456,15 @@ async fn stream_handler(
})
.await
{
Ok(Some(Some(reply))) => {
Ok(Some(Ok(reply))) => {
return Ok(Response::builder()
.status(StatusCode::CREATED)
.header("content-type", "application/sdp")
.body(reply)
.unwrap());
}
Ok(Some(None)) => {
return Ok(Response::builder()
.status(StatusCode::UNSUPPORTED_MEDIA_TYPE)
.body(String::new())
.unwrap());
Ok(Some(Err(codec))) => {
return Err(HttpError::WhepCodecError(codec));
}
Ok(None) => {
info!(