I am trying to set the Content-Length header before I stream a file out to the client. I am setting it with:

```
response.headers['Content-Length'] = "12341234"

```

and then i do something like:

```
steam do |out|
   file_chunks.each do |chunk|
     out << chunk
   end
   out.close
end

```

However when I attempt to down the file in a browser the Content-Length header is blank. Does anyone know whether this is a Sinatra issue or a Passenger/Apache issue?

I assume whats happening is some layer between this block of code and when the response actually gets sent it seeing that it first sends the headers and the data block is empty so it assumes a content-length of 0 even though I set it explicitly. 

Is there another way to tell the browser how big the file is that I'm sending it?

**EDIT**

Looks to be a passenger problem not a Sinatra problem. If I run the server with thin the Content-Length is passed correctly. I guess the question changes to not change the Content-Length if it is already set?