Got it. Will make those updates in the morning. Thanks for the quick 
feedback!


On 2/10/2014 8:59 PM, James Roper wrote:
>
> In 
> framework/src/play/src/main/scala/play/api/controllers/HeadAction.scala:
>
> > +import play.api.http.{ HeaderNames, DefaultWriteables }
> > +import scala.concurrent.duration._
> > +import scala.concurrent.Await
> > +
> > +/**
> > + * RFC2616-compatible HEAD implementation: provides a full header set and empty body for a given GET resource
> > + *
> > + * @param handler Action for the relevant GET path.
> > + */
> > +class HeadAction(handler: Handler) extends EssentialAction with DefaultWriteables {
> > +  def apply(requestHeader: RequestHeader) = {
> > +
> > +    def bodyIterator: Iteratee[Array[Byte], SimpleResult] = handler.asInstanceOf[EssentialAction](requestHeader)
> > +
> > +    def bypassBody(result: SimpleResult): SimpleResult = {
> > +      // We block briefly here to enumerate the body; necessary to provide a content_length
>
> Unfortunately we can't do that - blocking in this instance is 
> absolutely out of the question, and especially consuming the entire 
> body - if this was producing a 10GB file, we'll get an out of memory 
> error. What we should do here is replicate Play's behaviour here:
>
> https://github.com/playframework/playframework/blob/master/framework/src/play/src/main/scala/play/core/server/netty/NettyResultStreamer.scala
>
> In that case, if it's chunked, or if there's a content length, then we 
> should send the headers as is, and feed the body into the Done 
> iteratee. Otherwise, we should attempt to (asynchronously) take one 
> chunk. If there's more than one chunk, then we should set the transfer 
> encoding to chunked if the protocol is HTTP 1.1, or just set no 
> content length header if the protocol is HTTP 1.0. Otherwise, if 
> there's exactly one chunk, we can send the content length header to be 
> the length of the chunk.
>
> —
> Reply to this email directly or view it on GitHub 
> <https://github.com/playframework/playframework/pull/2355/files#r9613731>.
>