Hi André. Thanks for your reply. The error I get is this:
Illegal request, responding with status '413 Request Entity Too Large': Request Content-Length 24090970 exceeds the configured limit of 8388608 While I could increase the max-content-length, this wouldn't work in general. I'd like to prevent that the entire file is first buffered in memory. I'm expecting that some files might be tens of gigabytes. Is there a way to circumvent that and get the content as an input stream? -Daniel On Wednesday, October 7, 2015 at 11:39:12 AM UTC+2, André wrote: > > Hi Daniel, > > what error msg do you get? Have you tried > increasing akka.http.server.parsing.max-content-length (reference > <http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0/scala/http/configuration.html> > ) > > https://github.com/akka/akka/issues/18533 could be related here and was > recently fixed. > > Cheers > André > > On Wednesday, October 7, 2015 at 9:30:08 AM UTC+2, Daniel Bauer wrote: >> >> I'm using akka http to implement a REST service and that works fine >> except for one case. The HTTP message parser has a limit on the message >> size. This means that I cannot upload "large" data using a simple POST >> message, extract the "entity.dataBytes" and write that to a file. Is there >> a way how I can get access to a "raw" stream such that it also works with >> arbitrary file sizes? The simplistic solution below doesn't work for large >> data (due to the message size limitation): >> >> val routes = { >> pathSingleSlash { >> (post & extractRequest) { >> request => { >> val source = request.entity.dataBytes >> val outFile = new File("/tmp/outfile.dat") >> val sink = SynchronousFileSink.create(outFile) >> val repl = source.runWith(sink).map(x => s"Finished uploading >> ${x} bytes!") >> onSuccess(repl) { repl => >> complete(HttpResponse(status = StatusCodes.OK, entity = repl)) >> } >> } >> } >> } >> } >> >> Http().bindAndHandle(routes, config.getString("http.interface"), >> config.getInt("http.port")) >> >> >> -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
