Project

General

Profile

Feature #2017

X-Sendfile handoff to mod-static-file in 1.4.x

Added by PaulM about 8 years ago. Updated about 1 year ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
mod_fastcgi
Target version:
Start date:
2009-07-01
Due date:
% Done:

100%

Estimated time:
Missing in 1.5.x:

Description

A common use case for X-Sendfile is simple authentication - a backend determines if a user should get a file, and if so, fires off an X-Sendfile. In this use case, it makes very little sense for the backend to re-implement the things that lighttpd already does for serving other static files - figuring out and serving Content Type headers, ETags, 304 responses, etc.

Essentially, I'd like a way to tell lighty to "just serve the file the way you'd serve any other static file".

1.5 apparently has this feature as mentioned here: http://blog.lighttpd.net/articles/2006/07/22/mod_proxy_core-got-x-sendfile-support


Related issues

Related to Feature #799: mod_fastcgi + X-Sendfile -> mod_staticfileFixed

Related to Feature #2076: X-sendfile should be able to set content-typeFixed2009-10-02

Related to Feature #2253: scgi x-sendfileFixed2010-08-26

Associated revisions

Revision 4a51d2ab (diff)
Added by gstrauss about 1 year ago

[core] http_response_send_file() shared code (#2017)

move code from mod_staticfile.c to http-header-glue.c to allow reuse
(includes ETag, Last-Modified headers, Range requests for static files)

operate on path arg instead of con->physical.path
skip Range requests if con->http_status already set >= 300
remove redundant calls to stat_cache_get_entry() handling Range requests

x-ref:
"X-Sendfile handoff to mod-static-file in 1.4.x"
https://redmine.lighttpd.net/issues/2017

Revision b9940f98 (diff)
Added by gstrauss about 1 year ago

[mod_fastcgi] use http_response_xsendfile() (fixes #799, fixes #851, fixes #2017, fixes #2076)

handle X-Sendfile and X-LIGHTTPD-send-file w/ http_response_xsendfile()
if host is configured ( "x-sendfile" = "enable" )

Note: X-Sendfile path is url-decoded for consistency, like X-Sendfile2
(response headers should be url-encoded to avoid tripping over
chars allowed in filesystem but which might change response
header parsing semantics)

Note: deprecated: "allow-x-send-file"; use "x-sendfile"
Note: deprecated: X-LIGHTTPD-send-file header; use X-Sendfile header
Note: deprecated: X-Sendfile2 header; use X-Sendfile header
For now, X-Sendfile2 is still handled internally by mod_fastcgi.

Since http_response_send_file() supports HTTP Range requests,
X-Sendfile2 is effectively obsolete. However, any code, e.g. PHP,
currently using X-Sendfile2 is probably manually generating 206 Partial
Content status and Range response headers. A future version of lighttpd
might *remove* X-Sendfile2. Existing code should be converted to use
X-Sendfile, which is easily done by removing all the special logic
around using X-Sendfile2, since the 206 Partial Content status and Range
response headers are handled in http_response_send_file().

x-ref:
"mod_fastcgi + X-Sendfile -> mod_staticfile"
https://redmine.lighttpd.net/issues/799
"Feature Request: New option "x-send-file-docroot""
https://redmine.lighttpd.net/issues/851
"X-Sendfile handoff to mod-static-file in 1.4.x"
https://redmine.lighttpd.net/issues/2017
"X-sendfile should be able to set content-type"
https://redmine.lighttpd.net/issues/2076

Revision c380d227
Added by gstrauss about 1 year ago

[mod_cgi,mod_fastcgi,mod_scgi] X-Sendfile features

[core] http_response_send_file() shared code (#2017)
[mod_fastcgi] use http_response_xsendfile()
(fixes #799, fixes #851, fixes #2017, fixes #2076)
[mod_scgi] X-Sendfile feature (fixes #2253)
[mod_cgi] X-Sendfile feature (fixes #2313)

Merge branch 'feature-2017-http_response_send_file' into master

github: closes #59

History

#1 Updated by gstrauss over 1 year ago

  • Related to Feature #799: mod_fastcgi + X-Sendfile -> mod_staticfile added

#2 Updated by gstrauss over 1 year ago

  • Related to Feature #2076: X-sendfile should be able to set content-type added

#3 Updated by gstrauss over 1 year ago

#4 Updated by gstrauss over 1 year ago

  • Status changed from New to Patch Pending
  • Target version set to 1.4.40

#5 Updated by gstrauss about 1 year ago

  • Status changed from Patch Pending to Fixed
  • % Done changed from 0 to 100

Also available in: Atom