akka/akka-http

Respect Content-Transfer-Encoding in BodyPartParser

Ouverte

#109 ouverte le 8 sept. 2016

 (8 commentaires) (3 réactions) (0 personne assignée)Scala (598 forks)batch import
1 - triagedhelp wantednice-to-have (low-prio)

Métriques du dépôt

Stars
 (1 311 étoiles)
Métriques de merge PR
 (Merge moyen 1j 10h) (2 PRs mergées en 30 j)

Description

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.

Guide contributeur