chiark / gitweb /
server: wip
[hippotat.git] / src / bin / server.rs
index 8446dd3b1b13c5e680a46d3cf1f223ea4df6cd45..9bba6dd8420376bb0cf1ee3d515bbd62fecc9d88 100644 (file)
@@ -71,7 +71,12 @@ async fn handle(
     else { throw!(anyhow!("initial boundary not found")) };
 
     let comp = multipart::process_component
-      (&mut warnings, &initial[start..], PartName::m)?;
+      (&mut warnings, &initial[start..], PartName::m)?
+      .ok_or_else(|| anyhow!(r#"no "m" component"#))?;
+
+    if comp.name != PartName::m { throw!(anyhow!(
+      r#"first multipart component must be name="m""#
+    )) }
 
     eprintln!("boundary={:?} initial={:?} start={} comp={:?}",
               boundary, initial, start, &comp);