New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multipart request parsing fails in LF mode with certain binary data. #2581
Comments
Hi @cyburgee, sorry, it seems this one fell through the cracks. I guess one reason is that the relaxed line ending parsing mode was contributed and we are not so confident with its workings. In any case, thanks for the details. If I understand correctly, the current behavior is to use a heuristic by default to figure out line endings of body parts. However, what you found out, is that the heuristic can be mislead when the body part contents contain CR or LF characters that are not supposed to be a line ending (which is likely with binary data). My basic stance is that we must make sure that the heuristic works fine for all cases of well-defined body parts according to the specs (i.e. using CRLF). For all other cases, we are in nice-to-be-supported area. Your suggestion looks reasonable, though, so if you still want, please open a PR. |
* Improved the heuristic for detecting end of line character(s) * Added tests for UndefinedEndOfLineConfiguration
* Improved the heuristic for detecting end of line character(s) * Added tests for UndefinedEndOfLineConfiguration
* Improved the heuristic for detecting end of line character(s) * Added tests for UndefinedEndOfLineConfiguration
* Improved the heuristic for detecting end of line character(s) * Added tests for UndefinedEndOfLineConfiguration
* Improved the heuristic for detecting end of line character(s) * Added tests for UndefinedEndOfLineConfiguration
Refs akka#2581 * Improved the heuristic for detecting end of line character(s) * Added tests for UndefinedEndOfLineConfiguration Co-authored-by: Johannes Rudolph <johannes.rudolph@gmail.com>
10.1 Backport of #3076 Refs #2581 * Improved the heuristic for detecting end of line character(s) * Added tests for UndefinedEndOfLineConfiguration Co-authored-by: Johannes Rudolph <johannes.rudolph@gmail.com> (cherry picked from commit 428877e) Co-authored-by: Collin Burger <collin.e.burger@gmail.com>
Fixed by #3076. |
Hello maintainers,
I've encountered an issue whereby POST requests with certain binary data fail with an error message reading:
akka.http.scaladsl.model.ParsingException: Unexpected end of multipart entity
This is rectified by formatting the multipart request in CRLF mode, so I believe there is an issue with the EOL detection here:
https://github.com/akka/akka-http/blob/master/akka-http-core/src/main/scala/akka/http/impl/engine/parsing/BodyPartParser.scala#L338
I put together what might be a fix here:
https://github.com/cyburgee/akka-http/blob/multipart-eol-parsing/akka-http-core/src/main/scala/akka/http/impl/engine/parsing/BodyPartParser.scala#L338
and a test with an example entity here:
https://github.com/cyburgee/akka-http/blob/multipart-eol-parsing/akka-http-core/src/test/scala/akka/http/impl/engine/parsing/RequestParserSpec.scala#L682
My change makes the assumption that the EOL should be indicated immediately after the occurrence of a
boundary
pattern in the request. However, I may be totally off here.Please let me know if you need any more information.
The text was updated successfully, but these errors were encountered: