Hey there,
i've got some binary data (in fact it is a pcap file content) in my $res scalar and within my controller i do the following let this content be downloaded by the browswer.
$self->res->headers->content_type('application/x-download');
$self->res->headers->content_disposition("attachment; filename=$id.bin;");
return $self->render(data => $res);
Whats going wrong is that the binary that i download with (different) browsers is different than the original data, the md5_hex($res) is different then md5sum on my file on console.
When looking closer on the content, downloaded and original data, i see that there are some bytes in the beginning that differ (though they have the same size, which is extra confusing)
/tmp % head -n 2 download.hex result.hex
==> download.hex <==
0000000: c394 c383 c2b2 c2a1 0200 0400 0000 0000 ................
0000010: 0000 0000 c3bf c3bf 0000 0100 0000 68c2 ..............h.
==> result.hex <==
0000000: d4c3 b2a1 0200 0400 0000 0000 0000 0000 ................
0000010: ffff 0000 0100 0000 6889 dd55 b7da 0100 ........h..U....
% ls -l 290028E2-50B7-11E5-9379-5C5CF516A027.bin
-rw-r----- 1 martin martin 1519484 Sep 2 11:04 290028E2-50B7-11E5-9379-5C5CF516A027.bin
ls -l result
-rw-r----- 1 martin martin 1519484 Sep 2 11:07 result
Can you point out what i am doing wrong?