| #
12ead38a
|
| 08-Jul-2026 |
Andreas Gohr <gohr@cosmocode.de> |
fix(httputils): canonicalize paths when building X-Accel-Redirect URLs
http_xaccel_url() compared the fullpath()-collapsed target file against a non-canonicalized DOKU_INC and the raw savedir config
fix(httputils): canonicalize paths when building X-Accel-Redirect URLs
http_xaccel_url() compared the fullpath()-collapsed target file against a non-canonicalized DOKU_INC and the raw savedir config value. The lib/exe entry points define DOKU_INC as __DIR__.'/../../' and savedir defaults to the relative './data', so the in-tree prefix check never matched: nginx installs using X-Accel-Redirect served in-tree files behind the /_x_accel_redirect/ escape hatch and returned 404 without extra location config.
Canonicalize DOKU_INC and every configured root with fullpath() before the prefix comparisons so they match the already-canonicalized file path.
The comparison lost its fullpath() wrapping in b8c2692f7, which replaced the earlier substr($file, strlen(fullpath(DOKU_INC)) + 1) with a raw DOKU_INC prefix check.
show more ...
|
| #
a7e10216
|
| 25-Jun-2026 |
splitbrain <86426+splitbrain@users.noreply.github.com> |
Rector and PHPCS fixes
|
| #
b8c2692f
|
| 29-May-2026 |
Andreas Gohr <andi@splitbrain.org> |
fix(httputils): build a proper internal URL for nginx X-Accel-Redirect
Unlike Apache's mod_xsendfile and lighttpd's X-LIGHTTPD-send-file, which both accept an absolute file system path and stream th
fix(httputils): build a proper internal URL for nginx X-Accel-Redirect
Unlike Apache's mod_xsendfile and lighttpd's X-LIGHTTPD-send-file, which both accept an absolute file system path and stream the file directly, nginx treats X-Accel-Redirect as a URL: it performs an internal subrequest against the value and resolves it through `internal` location blocks in its own configuration. The redirect target therefore must be a request path nginx can map back to a file, not the file system path itself.
The previous implementation blindly stripped DOKU_INC's length from the file path, which produced a broken URL whenever a data directory had been relocated outside the DokuWiki tree.
Route the file through three cases instead: files inside DOKU_INC keep their path relative to the wiki root; files in a relocated mediadir, mediaolddir, cachedir or savedir are mapped back to their default URL below data/; everything else falls through an opt-in /_x_accel_redirect/ prefix.
Path segments are URL-encoded so filenames with spaces or other special characters resolve (fixes another potential bug in the previous implementation).
Nginx configuration:
For the default layout no extra configuration is needed - files keep their path relative to the wiki root and the regular wiki location already serves them. For relocated data directories admins must add an `internal` location below the wiki's URL space pointing at the actual file system path, e.g.:
location /data/media/ { internal; alias /srv/dokuwiki-media/; }
For the /_x_accel_redirect/ fallback (used when a plugin serves files from outside the wiki and its data directories), admins opt in by adding:
location /_x_accel_redirect/ { internal; alias /; }
When the wiki is installed under a sub path, prefix both locations accordingly (e.g. /wiki/data/media/ and /wiki/_x_accel_redirect/).
fixes: #2895
show more ...
|
| #
6c16a3a9
|
| 14-Sep-2023 |
fiwswe <fiwswe@fwml.de> |
Use str_starts_with/str_ends_with
|
| #
d4f83172
|
| 31-Aug-2023 |
Andreas Gohr <andi@splitbrain.org> |
code style: line breaks
|
| #
26dfc232
|
| 31-Aug-2023 |
Andreas Gohr <andi@splitbrain.org> |
Rector to rename print to echo calls
|
| #
24870174
|
| 29-Aug-2023 |
Andreas Gohr <andi@splitbrain.org> |
Apply rector fixes to the rest of inc
|
| #
2b9be456
|
| 10-Nov-2022 |
Andreas Gohr <andi@splitbrain.org> |
some more fixes for undefined vars
This makes more use of $INPUT to access $_SERVER and fixes a warning in one of the search methods.
|
| #
13c37900
|
| 27-Nov-2015 |
Andreas Gohr <andi@splitbrain.org> |
streamline zlib checking #1410
Instead of having various function_exists checks all over the place, this introduces the constants DOKU_HAS_GZIP and DOKU_HAS_BZIP. All non-3rdparty parts of the code
streamline zlib checking #1410
Instead of having various function_exists checks all over the place, this introduces the constants DOKU_HAS_GZIP and DOKU_HAS_BZIP. All non-3rdparty parts of the code using gz* functions should now check if zlib is actually available.
show more ...
|
| #
4a0b7669
|
| 27-Nov-2015 |
Andreas Gohr <andi@splitbrain.org> |
make sure zlib exists when trying to use gzip_output #1410
|
| #
42ea7f44
|
| 01-Oct-2014 |
Gerrit Uitslag <klapinklapin@gmail.com> |
Many PHPDocs, some unused and dyn declared vars
many PHPDocs some unused variables some dynamically declared variables declared
|
| #
f327a5f0
|
| 02-Mar-2014 |
Christopher Smith <chris@jalakai.co.uk> |
Merge branch 'master' into FS#2388
|
| #
90124802
|
| 17-Feb-2014 |
Gerrit Uitslag <klapinklapin@gmail.com> |
fix httputils PHPDocs
|
| #
446b5b59
|
| 15-Feb-2014 |
Dominik Eckelmann <deckelmann@gmail.com> |
FS#2388 give relative path to sendfile on nginx
|
| #
40e0b444
|
| 15-Feb-2014 |
Dominik Eckelmann <deckelmann@gmail.com> |
use http_sendfile correct
|
| #
b051e974
|
| 22-Mar-2013 |
Christopher Smith <chris@jalakai.co.uk> |
code changes in the rest of the code base to support testing fetch
|
| #
9d2e1be6
|
| 16-Feb-2013 |
Andreas Gohr <andi@splitbrain.org> |
introduced http_status() for sending HTTP status code FS#1698
It seems, some servers require a special Status: header for sending the HTTP status code from PHP (F)CGI to the server. This patch intro
introduced http_status() for sending HTTP status code FS#1698
It seems, some servers require a special Status: header for sending the HTTP status code from PHP (F)CGI to the server. This patch introduces a new function (adopted from CodeIgniter) for simplifying the status handling.
show more ...
|
| #
93b2e677
|
| 24-Aug-2012 |
Michael Hamann <michael@content-space.de> |
Declare timestamp parameter of http_conditionalRequest as int
|
| #
96946cc9
|
| 21-Mar-2012 |
Dominik Eckelmann <deckelmann@gmail.com> |
replaced $HTTP_RAW_POST_DATA with http_get_raw_post_data function
|
| #
6619f42e
|
| 01-Jul-2011 |
Adrian Lang <mail@adrianlang.de> |
Refactor CSS and JS caching
* Increase HTTP cache time since the resources are timestamped on request anyway * Check userscript.js only once for JS cache validation * Use cache class
|
| #
23a96c41
|
| 03-Oct-2010 |
Elan Ruusamäe <glen@delfi.ee> |
- update urls
|
| #
c66972f2
|
| 04-Nov-2009 |
Adrian Lang <lang@cosmocode.de> |
Emit less E_NOTICEs and E_STRICTs
Changes of behaviour are: * Allow the user name, title & description \e2\80\9c0\e2\80\9d * Default to Port 443 if using HTTPS * Set $INFO['isadmin'] and $IN
Emit less E_NOTICEs and E_STRICTs
Changes of behaviour are: * Allow the user name, title & description \e2\80\9c0\e2\80\9d * Default to Port 443 if using HTTPS * Set $INFO['isadmin'] and $INFO['ismanager'] to \e2\80\9cfalse\e2\80\9d even if no user is logged in * Do not pass empty fragment field in the event data for event ACTION_SHOW_REDIRECT * Handle chunked encoding in HTTPClient
darcs-hash:20091104100115-e4919-5cf6397d4a457e3f98a8ca49fbdab03f2147721d.gz
show more ...
|
| #
db959ae3
|
| 20-Oct-2009 |
Andreas Gohr <andi@splitbrain.org> |
Coding Standard Cleanup
Ignore-this: 259cb5773c3144c6c706d87298dcf674
darcs-hash:20091020212338-7ad00-6bf1c5c403491f136a1c02af5ecd9f84d7227107.gz
|
| #
b8b5563e
|
| 16-Mar-2009 |
Andreas Gohr <andi@splitbrain.org> |
fixed headers in multipart HTTP replies FS#1630
Ignore-this: 5bd12feffff1224e4cb3e1acf7fa86a0
darcs-hash:20090316191939-7ad00-0e3754648db6932ef2e0d7eec4668f50bdc85b87.gz
|
| #
758447cf
|
| 13-Mar-2009 |
Andreas Gohr <andi@splitbrain.org> |
Support for multirange requests for media FS#1630
Ignore-this: 50de569608231b910a62327d2f3af1de
This patch moves all HTTP sending related functions to inc/httputils.php
Handling of range requests
Support for multirange requests for media FS#1630
Ignore-this: 50de569608231b910a62327d2f3af1de
This patch moves all HTTP sending related functions to inc/httputils.php
Handling of range requests was rewritten completely to support mutirange requests. This should fix problems with Adobe Reader but needs testing.
darcs-hash:20090313190247-7ad00-e6ec1f81acb9f7ac651357dd034c2689aea6868d.gz
show more ...
|