Project

General

Profile

Actions

Feature #1702

closed

multiple X-Sendfile for sending multiple files

Added by Anonymous almost 16 years ago. Updated 4 months ago.

Status:
Fixed
Priority:
Normal
Category:
mod_fastcgi
Target version:
-
ASK QUESTIONS IN Forums:
No

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.

Actions #1

Updated by Anonymous almost 16 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.

Actions #2

Updated by Anonymous almost 16 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).

Actions #3

Updated by Anonymous almost 16 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.

Actions #4

Updated by Anonymous almost 16 years ago

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


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

Updated by gstrauss almost 8 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

Actions #6

Updated by gstrauss 4 months ago

  • Status changed from Wontfix to Fixed
  • Target version deleted (1.5.0)
  • ASK QUESTIONS IN Forums set to No

What you seem to be trying to do is possible with the lighttpd-specific and mod_fastcgi-specific X-Sendfile2 response header. mod_fastcgi

Actions

Also available in: Atom