akka/akka-http

Respect Content-Transfer-Encoding in BodyPartParser

開放

#109 建立於 2016年9月8日

 (8 則留言) (3 個反應) (0 位負責人)Scala (598 個分叉)batch import
1 - triagedhelp wantednice-to-have (low-prio)

倉庫指標

星標
 (1,311 顆星)
PR 合併指標
 (平均合併 1天 10小時) (30 天內合併 2 個 PR)

描述

Issue by kswmsw Monday Feb 23, 2015 at 17:15 GMT Originally opened as https://github.com/akka/akka/issues/16921


akka.http.engine.parsing.BodyPartParser in akka-http-core-experimental 1.0-M3 ignores the Content-Transfer-Encoding header when parsing the entity. This means that currently if a client uploads a body part with Content-Transfer-Encoding quoted-printable or base64, the wrong data is passed to the application with no error or warning.

Instead, Akka should respect this header, and use its value to decode the bytes of the incoming stream when constructing the bytes of the body part. The dataBytes of the parsed body part should be the decoded bytes of the body part, not the raw bytes of the multipart entity.

The relevant standards are RFC2046 section 5.1 and RFC2045 section 6. According to these, each part of a multipart entity may have a Content-Transfer-Encoding. If this has value quoted-printable or base64, then the content of the body part has been encoded with the named encoding. If it is 7bit, 8bit, binary, or omitted, then no encoding has been applied.

Apache Commons has Base64 and QuotedPrintableCodec which may be applicable in an implementation.

貢獻者指南