fix(http): reject unsupported codecs with 415 and the codec as body
This commit is contained in:
@@ -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!(
|
||||
|
||||
Reference in New Issue
Block a user