{"action":"created","issue":{"url":"https://api.github.com/repos/akka/akka/issues/17051","labels_url":"https://api.github.com/repos/akka/akka/issues/17051/labels{/name}","comments_url":"https://api.github.com/repos/akka/akka/issues/17051/comments","events_url":"https://api.github.com/repos/akka/akka/issues/17051/events","html_url":"https://github.com/akka/akka/issues/17051","id":62668432,"number":17051,"title":"Multipart MIME parser may swallow MIME errors depending on stream chunk size","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":[{"url":"https://api.github.com/repos/akka/akka/labels/1%20-%20triaged","name":"1 - triaged","color":"5319e7"},{"url":"https://api.github.com/repos/akka/akka/labels/bug","name":"bug","color":"e11d21"},{"url":"https://api.github.com/repos/akka/akka/labels/t:http","name":"t:http","color":"ededed"},{"url":"https://api.github.com/repos/akka/akka/labels/t:http:core","name":"t:http:core","color":"ededed"},{"url":"https://api.github.com/repos/akka/akka/labels/t:http:next","name":"t:http:next","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/akka/akka/milestones/50","html_url":"https://github.com/akka/akka/milestones/http-1.0-RC4","labels_url":"https://api.github.com/repos/akka/akka/milestones/50/labels","id":1123079,"number":50,"title":"http-1.0-RC4","description":"","creator":{"login":"drewhk","id":932285,"avatar_url":"https://avatars.githubusercontent.com/u/932285?v=3","gravatar_id":"","url":"https://api.github.com/users/drewhk","html_url":"https://github.com/drewhk","followers_url":"https://api.github.com/users/drewhk/followers","following_url":"https://api.github.com/users/drewhk/following{/other_user}","gists_url":"https://api.github.com/users/drewhk/gists{/gist_id}","starred_url":"https://api.github.com/users/drewhk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drewhk/subscriptions","organizations_url":"https://api.github.com/users/drewhk/orgs","repos_url":"https://api.github.com/users/drewhk/repos","events_url":"https://api.github.com/users/drewhk/events{/privacy}","received_events_url":"https://api.github.com/users/drewhk/received_events","type":"User","site_admin":false},"open_issues":22,"closed_issues":0,"state":"open","created_at":"2015-05-21T11:31:42Z","updated_at":"2015-06-01T13:24:49Z","due_on":"2015-05-28T22:00:00Z","closed_at":null},"comments":9,"created_at":"2015-03-18T11:33:00Z","updated_at":"2015-06-04T16:07:29Z","closed_at":null,"body":"I have found that the `akka.http.unmarshalling.MultipartUnmarshallers` will behave quite differently with invalid MIME streams depending on how the stream has been divided into chunks.\r\n\r\nI have uploaded a failing test to https://gist.github.com/RichardBradley/0e73adaa86c4d377bf65/95ff8af7298ad64808700fee59e736a4c1e10031\r\n\r\n(Run it with `sbt test`)\r\n\r\nI have picked out one example: when a MIME body part is missing its headers, the MIME parser will throw a fairly helpful error if the request is `Strict`:\r\n```\r\nakka.http.model.ParsingException: Illegal character ' ' in header name\r\n```\r\n\r\nHowever, if the same MIME stream is `Default` or `Chunked`, then the error will not be thrown. Instead the BodyPart stream will be truncated (without error) at varying lengths depending on the exact chunk size used.\r\n"},"comment":{"url":"https://api.github.com/repos/akka/akka/issues/comments/108950800","html_url":"https://github.com/akka/akka/issues/17051#issuecomment-108950800","issue_url":"https://api.github.com/repos/akka/akka/issues/17051","id":108950800,"user":{"login":"jrudolph","id":9868,"avatar_url":"https://avatars.githubusercontent.com/u/9868?v=3","gravatar_id":"","url":"https://api.github.com/users/jrudolph","html_url":"https://github.com/jrudolph","followers_url":"https://api.github.com/users/jrudolph/followers","following_url":"https://api.github.com/users/jrudolph/following{/other_user}","gists_url":"https://api.github.com/users/jrudolph/gists{/gist_id}","starred_url":"https://api.github.com/users/jrudolph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrudolph/subscriptions","organizations_url":"https://api.github.com/users/jrudolph/orgs","repos_url":"https://api.github.com/users/jrudolph/repos","events_url":"https://api.github.com/users/jrudolph/events{/privacy}","received_events_url":"https://api.github.com/users/jrudolph/received_events","type":"User","site_admin":false},"created_at":"2015-06-04T16:07:29Z","updated_at":"2015-06-04T16:07:29Z","body":"There's more broken that this. Another test that fails is this one:\r\n\r\n```scala\r\n      \"an implicitly typed part (without headers) (Default)\" in {\r\n        val content = \"\"\"--XYZABC\r\n                        |\r\n                        |Perfectly fine part content.\r\n                        |--XYZABC--\"\"\".stripMarginWithNewline(\"\\r\\n\")\r\n        val byteStrings = content.map(c ⇒ ByteString(c.toString)) // one-char ByteStrings\r\n        Unmarshal(HttpEntity.Default(`multipart/mixed` withBoundary \"XYZABC\", content.length, Source(byteStrings)))\r\n          .to[Multipart.General] should haveParts(\r\n            Multipart.General.BodyPart.Strict(HttpEntity(ContentTypes.`text/plain(UTF-8)`, \"Perfectly fine part content.\")))\r\n      }\r\n```\r\n\r\nwhich is just one failing example where the first boundary itself is chunked. It seems in `tryParseInitialBoundary` too much data is thrown away in the continue call."}}