[pmg-devel] [PATCH http-server v2 1/1] AnyEvent: extend send_file with content-type

Dominik Csapak d.csapak at proxmox.com
Fri Oct 4 10:30:04 CEST 2019

On 10/4/19 9:45 AM, Thomas Lamprecht wrote:
> On 9/30/19 2:55 PM, Dominik Csapak wrote:
>> for pmg, we need to send temporary files (for the attachment quarantine),
>> but we cannot know beforehand what content-type it is, so we
>> optionally give it to send_file_start
>> we give a hash with the open filehandle and the content-type in that case
>> this also removes the unnecessary open on the filename, since we open
>> it in send_file_start anyway...
>> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
>> ---
>> changes from v1:
>> * do not delete here, let the caller handle it
>> * expect either a filename or a hash with fh and content-type
>> * remove unnecessary IO::File->new in caller (we open it there anyway)
> so you took this version of my proposal, what spoke against the other
> idea of passing the whole content already in the info data structure.
> In general fine for me, but some rational would be interesting here.
> Any issues with the other approach or just liked this one better?

i liked this approach a little better, since we already read the content 
of a filehandle in send_file_start and duplicating that code
seemed unecessary (i know it is not that much code, but still found it 
nicer this way)

but if you lean towards giving the content directly, i am
happy to change it in a v3 :)

More information about the pmg-devel mailing list