On Windows 7, a Play framework V2.4.1 serves a large file (near 650Mb) on localhost:8080. I can download it from my web browser chrome. When I try to do the same thing with Akka-http based client, I have an error described at the end of this post. If I replace the big file by a small one (5Mb), all is ok.
The trouble exist even if I set or not following configuration : akka.http.client.parsing.max-content-length = 800m Thanks for any help. See bellow all details. Returned error ============== URI=http://localhost:8080 [ERROR] [07/02/2015 09:27:33.125] [MySys-akka.actor.default-dispatcher-2] [ActorSystem(MySys)] Outgoing request stream error akka.http.scaladsl.model.IllegalResponseException: Response Content-Length 731408384 exceeds the configured limit of 8388608 at akka.http.impl.engine.client.OutgoingConnectionBlueprint$$anonfun$2.applyOrElse(OutgoingConnectionBlueprint.scala:76) at akka.http.impl.engine.client.OutgoingConnectionBlueprint$$anonfun$2.applyOrElse(OutgoingConnectionBlueprint.scala:73) at akka.stream.impl.fusing.Collect.onPush(Ops.scala:82) at akka.stream.impl.fusing.Collect.onPush(Ops.scala:77) at akka.stream.impl.fusing.OneBoundedInterpreter$$anon$1.run(Interpreter.scala:436) at akka.stream.impl.fusing.OneBoundedInterpreter$State$class.progress(Interpreter.scala:245) at akka.stream.impl.fusing.OneBoundedInterpreter$$anon$1.progress(Interpreter.scala:434) at akka.stream.impl.fusing.OneBoundedInterpreter.akka$stream$impl$fusing$OneBoundedInterpreter$$execute(Interpreter.scala:580) at akka.stream.impl.fusing.OneBoundedInterpreter$State$class.execute(Interpreter.scala:241) at akka.stream.impl.fusing.OneBoundedInterpreter$EntryState.execute(Interpreter.scala:666) at akka.stream.stage.AbstractStage.enterAndPush(Stage.scala:65) at akka.stream.impl.fusing.BatchingActorInputBoundary$$anonfun$upstreamRunning$1.applyOrElse(ActorInterpreter.scala:157) at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36) at akka.stream.impl.SubReceive.apply(Transfer.scala:16) at akka.stream.impl.SubReceive.apply(Transfer.scala:12) at scala.PartialFunction$class.applyOrElse(PartialFunction.scala:123) at akka.stream.impl.SubReceive.applyOrElse(Transfer.scala:12) at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:170) at akka.actor.Actor$class.aroundReceive(Actor.scala:467) at akka.stream.impl.fusing.ActorInterpreter.aroundReceive(ActorInterpreter.scala:366) at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516) at akka.actor.ActorCell.invoke(ActorCell.scala:487) at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:238) at akka.dispatch.Mailbox.run(Mailbox.scala:220) at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:397) at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) Play framework ============== routes : GET / controllers.Application.url_index application.scala : class Application extends Controller { def url_index = Action { Ok.sendFile(new File("c:/tmp/big_file.avi")) } } Downloader.scala : client side application ========================================== import java.io.File import java.io.FileInputStream import java.io.FileOutputStream import scala.util.Failure import scala.util.Success import akka.actor.ActorSystem import akka.http.scaladsl.Http import akka.http.scaladsl.model._ import akka.http.impl.util._ import akka.stream.ActorMaterializer import akka.stream.scaladsl.Sink import akka.stream.scaladsl.Source import akka.util.ByteString import com.typesafe.config.Config import com.typesafe.config.ConfigFactory object Downloader extends App { val config: Config = ConfigFactory.parseString( """ akka.http.client.parsing.max-content-length = 800m """) implicit val system = ActorSystem("MySys", config) implicit val materializer = ActorMaterializer() import system.dispatcher val host = "localhost" val port = 8080 val uri = "http://%s:%s".format(host, port) println("URI=" + uri) val result = Http().singleRequest(HttpRequest(uri = uri)) result.map(_.header[headers.Server]) onComplete { case Success(res) => val responseOpt = result.value val resp = responseOpt.get.get val sourceDataBytes: Source[ByteString, Any] = resp.entity.dataBytes sourceDataBytes.runForeach( x => { val fos = new FileOutputStream("c:/tmp1/z/tutu", true) fos.write(x.toArray) fos.close() } ) //system.shutdown() case Failure(error) => println("ERROR FAILURE") println(error) system.shutdown() } } -- >>>>>>>>>> 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.
