Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X-Sendfile w/ ETag, Last-Modified, range requests for FastCGI, SCGI, CGI #59

Merged

Conversation

gstrauss
Copy link
Member

@gstrauss gstrauss commented Apr 22, 2016

X-Sendfile w/ ETag, Last-Modified, range requests for FastCGI, SCGI, CGI

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

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

"scgi x-sendfile"
https://redmine.lighttpd.net/issues/2253

"X-sendfile support for mod_cgi"
https://redmine.lighttpd.net/issues/2313

@gstrauss gstrauss force-pushed the feature-2017-http_response_send_file branch 6 times, most recently from 8f4ffa5 to 5532b71 Compare April 24, 2016 20:36
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
@gstrauss gstrauss force-pushed the feature-2017-http_response_send_file branch 5 times, most recently from 3da72a5 to 439591a Compare April 28, 2016 01:29
…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
handle X-Sendfile with http_response_xsendfile() if host configured
  ( "x-sendfile" = "enable" )

x-ref:
  "scgi x-sendfile"
  https://redmine.lighttpd.net/issues/2253
handle X-Sendfile with http_response_xsendfile() if
  cgi.x-sendfile = "enable"

x-ref:
  "X-sendfile support for mod_cgi"
  https://redmine.lighttpd.net/issues/2313
@gstrauss gstrauss force-pushed the feature-2017-http_response_send_file branch from 439591a to 1f23ba9 Compare April 28, 2016 03:11
@lighttpd-git lighttpd-git merged commit 1f23ba9 into lighttpd:master May 2, 2016
lighttpd-git pushed a commit that referenced this pull request May 2, 2016
[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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants