Project

General

Profile

Feature #1702

multiple X-Sendfile for sending multiple files

Added by Anonymous about 11 years ago. Updated about 3 years ago.

Status:
Wontfix
Priority:
Normal
Assignee:
-
Category:
mod_fastcgi
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Missing in 1.5.x:

Description

It would be nice if lighttpd would send multiple files as one stream when multiple X-Sendfile headers are specified. In current version it sends nothing in such case.

I have a lot of files and want to send single zip from files that user selects. Now, I have to do this job completely in php, which consumes addititional memory for a long time in case of large zips. With multiple X-Sendfile it'll be possible to write zip-specific headers to /dev/shm/ and lighttpd will do the rest.

History

#1

Updated by Anonymous about 11 years ago

1. no we wont implement zip compression for you in lighttpd. building a zip is not just concatting files together.
2. the correct solution for your problem is: compressing the file in php. x-sendfile with the created zip path.

#2

Updated by Anonymous about 11 years ago

Replying to anonymous:

1. no we wont implement zip compression for you in lighttpd. building a zip is not just concatting files together.
2. the correct solution for your problem is: compressing the file in php. x-sendfile with the created zip path.

I'm not suggesting to implement zip compression in lighttpd, I'm just say that in response on 2 or more X-Sendfile headers lighttpd should output 2 or more files as one stream, for example:

header("Content-Type: text/plain");
header("X-Sendfile: /1.txt");
header("X-Sendfile: /2.txt", false);
?>

should output concatenated 1.txt and 2.txt. Currently, it outputs nothing (tested on Ubuntu 8.04, php 5.2.6, lighttpd 1.4.19).

#3

Updated by Anonymous about 11 years ago

You should be able to use mod_magnet to output the two files with something like {{{
lighty.content = { { filename = "/1.txt" }, { filename = "2.txt" } }
}}}
...but there's no way you can reconstruct a zip file on the fly with that.

I think your best bet would be to create the zip on disk (/tmp) with PHP then use X-Sendfile to send the file.

#4

Updated by Anonymous about 11 years ago

Erm, sorry about the markup, I forgot to preview it.


lighty.content = { { filename = "/1.txt" }, { filename = "2.txt" } }
#5

Updated by gstrauss about 3 years ago

  • Description updated (diff)
  • Status changed from New to Wontfix
  • Assignee deleted (jan)

Sorry, not planning on extending X-Sendfile: parsing to parse multiple files, although if you want to post a patch for others, feel free. The header that lighttpd gets after parsing the backend response is X-Sendfile: /1.txt, /2.txt and the file "/1.txt, /2.txt" does not exist. It should not be too difficult to parse the header and split on whitespace and comma-separated file names.

An alternative: it almost sounds as if you want to write your own server-side include (SSI) file and then have the backend trigger an internal redirect in lighttpd to serve the request from the SSI, which can include multiple files directly from disk. See also https://redmine.lighttpd.net/issues/2108

Also available in: Atom