[Catalyst] How to send raw HTTP response

Sebastian Riedel sri-lists at labs.kraih.com
Fri Sep 26 07:14:51 BST 2008


26.09.2008 00:20 Wade.Stuart at fallon.com:

> Tomas Doran <bobtfish at bobtfish.net> wrote on 09/25/2008 04:04:58 PM:
>
>>
>> On 25 Sep 2008, at 19:35, Christian Lackas wrote:
>>>
>>>    print CGI::header(...);
>>>    $ZIP->writeToFileHandle(*STDOUT);
>>>    for my $f (@files) {
>>>        $ZIP->addFile($f, basename($f));
>>>    }
>>>
>>> How can I achieve something similar under Catalyst?
>>
>> Looking at the source code for Catalyst::write, and
>> Catalyst::Engine::write, you need to say $c->finalize_headers, after
>> which just writing to STDOUT as above should do the right thing..
>>
>> However, I'd have thought that clients on the other end would be
>> somewhat unhappy with not getting a Content-Length header...
>
> The only two consequences I know of for not including the content  
> length is
> that the download bar for the transfer lists unknown in browsers,  
> and if
> the transfer fails midway the browser does not "know".

Things will go wrong, they always do.
Not following the RFC is a very bad idea, without a content-length  
header the client could react completely random.

The right way to do it would be a response with chunked transfer  
encoding.

--
sebastian



More information about the Catalyst mailing list