{"action":"opened","issue":{"url":"https://api.github.com/repos/akka/akka/issues/17110","labels_url":"https://api.github.com/repos/akka/akka/issues/17110/labels{/name}","comments_url":"https://api.github.com/repos/akka/akka/issues/17110/comments","events_url":"https://api.github.com/repos/akka/akka/issues/17110/events","html_url":"https://github.com/akka/akka/issues/17110","id":65403249,"number":17110,"title":"Akka MIME unmarshallers don’t accept or reject MIME with LF line endings","user":{"login":"RichardBradley","id":1265780,"avatar_url":"https://avatars.githubusercontent.com/u/1265780?v=3","gravatar_id":"","url":"https://api.github.com/users/RichardBradley","html_url":"https://github.com/RichardBradley","followers_url":"https://api.github.com/users/RichardBradley/followers","following_url":"https://api.github.com/users/RichardBradley/following{/other_user}","gists_url":"https://api.github.com/users/RichardBradley/gists{/gist_id}","starred_url":"https://api.github.com/users/RichardBradley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RichardBradley/subscriptions","organizations_url":"https://api.github.com/users/RichardBradley/orgs","repos_url":"https://api.github.com/users/RichardBradley/repos","events_url":"https://api.github.com/users/RichardBradley/events{/privacy}","received_events_url":"https://api.github.com/users/RichardBradley/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-31T09:04:26Z","updated_at":"2015-03-31T09:04:26Z","closed_at":null,"body":"The Akka MIME unmarshallers don’t accept (nor properly reject) MIME with LF line endings.\r\n\r\nI know that unix line endings are not valid MIME according to the RFC, but Spray 1.3 used to accept this kind of MIME (via the `org.jvnet.mimepull` library), and Postel's law would seem to apply.\r\n\r\nCurrently, if you pass Akka a MIME message with LF line endings, it parses successfully as a MIME bundle with zero BodyParts. I think that it should either be an error as the RFC states \"[The body must then contain **one or more** body parts](http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html)\", or (much better) it should parse the slightly broken MIME.\r\n\r\nHere’s a failing test demonstrating the issue. The equivalent test in Akka 1.3.1 passes:\r\n\r\n```\r\nimport akka.actor.ActorSystem\r\nimport akka.http.marshalling.Marshal\r\nimport akka.http.model.ContentTypes._\r\nimport akka.http.model.{HttpEntity, Multipart}\r\nimport akka.http.model.Multipart.FormData\r\nimport akka.http.unmarshalling.Unmarshal\r\nimport akka.stream.ActorFlowMaterializer\r\nimport akka.stream.scaladsl.Source\r\nimport akka.util.ByteString\r\nimport akka.http.marshalling.MultipartMarshallers._\r\nimport org.specs2.mutable.Specification\r\nimport org.specs2.time.NoTimeConversions\r\nimport scala.concurrent.{Future, Await}\r\nimport scala.concurrent.duration._\r\n\r\nclass MimeLineEndingsSpec\r\n  extends Specification\r\n  with NoTimeConversions {\r\n\r\n  implicit val system = ActorSystem()\r\n  implicit val fm = ActorFlowMaterializer()\r\n  val timeout = 1.second\r\n  private def await[T](future: Future[T]): T =\r\n    Await.result(future, timeout)\r\n\r\n  \"MIME unmarshallers\" should {\r\n    \"accept LF endings as well as CRLF\" in {\r\n      val unmarshalledMime = Multipart.FormData(Source(List(\r\n        FormData.BodyPart(\"first\",\r\n          HttpEntity.Strict(`text/plain`, ByteString(\"first part\"))),\r\n        FormData.BodyPart(\"second\",\r\n          HttpEntity.Strict(`text/plain`, ByteString(\"second part\"))))))\r\n\r\n      val marshalledMime = await(\r\n        Marshal(unmarshalledMime).to[HttpEntity].flatMap(_.toStrict(timeout)))\r\n\r\n      println(marshalledMime.data.utf8String)\r\n\r\n      val mimeWithUnixLineEndings = marshalledMime.copy(\r\n        data = ByteString(marshalledMime.data.utf8String.replace(\"\\r\\n\", \"\\n\")))\r\n\r\n      val unmarshalledMimeWithUnixLineEndings = await(\r\n        Unmarshal(mimeWithUnixLineEndings).to[Multipart.FormData])\r\n\r\n      // unmarshalledMimeWithUnixLineEndings here is 'FormData.Strict(Vector())'\r\n      // i.e. the whole body is treated as a MIME preamble and ignored.\r\n      //\r\n      // Shouldn't we get an error like \"no MIME boundary found\"?\r\n      // Or better (and like Spray 1.3), shouldn't we be able to parse LF MIME?\r\n      unmarshalledMimeWithUnixLineEndings mustEqual unmarshalledMime\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nThanks,\r\n\r\n\r\nRich\r\n"}}