changed values for send_file_mode config parameter:
0 - winix will read the content of the file and send it back to the webserver 1 - winix will use send_file_header header with a full path to the file 2 - winix will use send_file_header header with a relative path to the file
This commit is contained in:
@@ -73,18 +73,32 @@ void Download::MakeGet()
|
||||
cur->request->send_as_attachment = cur->request->IsParam(L"attachment");
|
||||
bool is_thumb = (cur->request->item.item_content.file_has_thumb && cur->request->IsParam(L"thumb"));
|
||||
|
||||
if( config->send_file_mode == 0 )
|
||||
if( config->send_file_mode == 0 || config->send_file_mode == 1 )
|
||||
{
|
||||
system->MakeFilePath(cur->request->item, cur->request->x_sendfile, is_thumb);
|
||||
|
||||
if( config->send_file_mode == 0 )
|
||||
{
|
||||
log << log3 << "Download: reading content of file: " << cur->request->x_sendfile << logend;
|
||||
|
||||
if( !GetBinaryFile(cur->request->x_sendfile, cur->request->out_bin_stream) )
|
||||
{
|
||||
log << log1 << "Download: I cannot read the content of the file: " << cur->request->x_sendfile << logend;
|
||||
}
|
||||
|
||||
// IMPROVEME it would be good to set Content-Type header too
|
||||
cur->request->x_sendfile.clear();
|
||||
cur->request->send_bin_stream = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
if( config->send_file_mode == 1 )
|
||||
if( config->send_file_mode == 2 )
|
||||
{
|
||||
system->MakeRelativeFilePath(cur->request->item, config->send_file_relative_prefix, cur->request->x_sendfile, is_thumb);
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Download: send_file_mode in the config should be either 0 or 1" << logend;
|
||||
log << log1 << "Download: send_file_mode in the config should be either 0, 1 or 2" << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user