Hi
After disabling the content-length limit I get OutOfMemory error. That 
clearly means that akka-http reads the entire response into memory which is 
not desired in my case.
Since I don't try to read the entity, this could be considered a bug?

I tried to reconstruct the response object in flatMap:

    Source.single(proxyReq)
      .via(flow)
      .runWith(Sink.head)
      .flatMap(rsp => {
        val source: Source[ByteString,_] = req.entity.dataBytes
        val entity = HttpEntity(ContentTypes.`application/octet-stream`,source)
        val response = HttpResponse(rsp.status,rsp.headers,entity)
        context.complete(response)
      })

but doesn't help.

Somehow I need to instruct to stream the source, but just not getting the 
right code
I'm thinking on something like:

 val source: Source[ByteString,_] = 
Source.single(req.entity.dataBytes).runWith(Sink.head)

but unfortunately this doesn't compile.

As a test I tried to write the response into a file:

 .flatMap(f => {
        f.entity.dataBytes.runWith(FileIO.toPath(new 
File("/tmp/example.out").toPath()))
        val entity = HttpEntity.Empty
        context.complete(entity)
      })

This works and properly streams the response into the file without 
exploding the memory.

Any idea?

-- 
>>>>>>>>>>      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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to