Commit Graph

2974 Commits

Author SHA1 Message Date
Glenn Strauss 338c73fd28 [core] use high precision stat timestamp in etag
use high precision stat timestamp (on systems where available) in etag
2019-05-04 13:48:22 -04:00
Glenn Strauss 311f258ab3 [mod_webdav] update stat_cache after file mod
update stat_cache entries after file modifications (PUT)
invalidate stat_cache entries after file movement (COPY MOVE DELETE)
2019-05-04 13:48:22 -04:00
Glenn Strauss 57470365a2 [stat_cache] interfaces to invalidate entries 2019-05-04 13:48:22 -04:00
Glenn Strauss f89f9191f4 [stat_cache] FAM: funcs to invalidate entries 2019-05-04 13:48:22 -04:00
Glenn Strauss c7eaa502ec [stat_cache] FAM: ignore event with no valid match 2019-05-04 13:48:22 -04:00
Glenn Strauss 18faa0910c [stat_cache] FAM: check hash collision before add
skip monitoring new entry if there is a hash collision in stat_cache
data structure associated with FAM
2019-05-04 13:48:22 -04:00
Glenn Strauss 8772e85cea [stat_cache] FAM: ignore follow-symlink config
no distinction needs to be made whether or not server.follow-symlink set
2019-05-04 13:48:22 -04:00
Glenn Strauss 1971da13db [stat_cache] FAM: improve handling modified file 2019-05-04 13:48:22 -04:00
Glenn Strauss 38ce790657 [stat_cache] FAM: use entry hash index as userdata
Upon receipt of FAM event, validate that entry exists in splaytree
instead of blindly accessing memory through the pointer returned in
userdata by FAM
2019-05-04 13:48:22 -04:00
Glenn Strauss a3d171526a [stat_cache] FAM: check FAMNextEvent() return code 2019-05-04 13:48:22 -04:00
Glenn Strauss cc49703372 [stat_cache] FAM: reduce string copying 2019-05-04 13:48:22 -04:00
Glenn Strauss a50b72c356 [stat_cache] remove splaytree ins/del debug code
remove debug code around for splaytree_insert() and splaytree_delete()
in stat_cache.c
2019-05-04 13:48:22 -04:00
Glenn Strauss 47d006ae47 [stat_cache] pass age param for stat cache cleanup 2019-05-04 13:48:22 -04:00
Glenn Strauss baa5f04335 [stat_cache] store entries without trailing slash
(no more duplication of dir entries with and without trailing slash)
2019-05-04 13:48:22 -04:00
Glenn Strauss 020a83c265 [stat_cache] separate symlink pol from data struct
separate symlink polily from internal data structures
no more dup entires in splaytree for allowing/disallowing symlinks

hash name to provided len
2019-05-04 13:48:11 -04:00
Glenn Strauss 73bfee6308 [stat_cache] separate func for symlink policy chk
Note: historical ToC-ToU race condition still exists in implementation
server.follow-symlink = "disable" is not recommended (default: "enable")
2019-04-29 18:11:15 -04:00
Glenn Strauss 5ac92dca08 [mod_webdav] check If-None-Match (#1818)
  "add RFC-compliant LOCK support to mod_webdav"
2019-04-23 10:36:55 -04:00
Glenn Strauss aacdd3da02 [mod_webdav] special-case If: (<DAV:no-lock>)
(recognize <DAV:no-lock>, but supporting logic is limited)
2019-04-23 10:36:55 -04:00
Glenn Strauss ab005809e1 [mod_webdav] disable elftc_copyfile() on FreeBSD
disable elftc_copyfile() on FreeBSD
until libelftc added to SCons static build
2019-04-22 02:36:53 -04:00
Glenn Strauss 278c42abc5 [mod_webdav] platform portability fixes 2019-04-22 02:18:56 -04:00
Glenn Strauss d4b726bf24 [mod_webdav] provide ETag in more responses
When file is already open, fstat() and provide ETag,
e.g. in PUT requests and new LOCK requests (not LOCK refresh)
2019-04-22 01:09:28 -04:00
Glenn Strauss d334ee5c2f [mod_webdav] deprecated unsafe partial PUT compat
RFC 7231 forbids partial PUT.  However, historical versions of
lighttpd mod_webdav did provide this (mis-)feature.  Therefore,
provide *deprecated* unsafe partial PUT support for compatibility
with historical lighttpd mod_webdav (prior to mod_webdav rewrite),
but require new config option to enable this compatible behavior:

webdav.opts = ( "deprecated-unsafe-partial-put" => "enable" )

The partial PUT support implemented by historical lighttpd mod_webdav
makes no effort to account for shrinkage or growth of range replaced.
The request body is splat into the *existing* file at the offset
provided which is quite unsafe and can cause corruption in data sent
to concurrent download requests.

Use of this (mis-)feature is discouraged, and support may be removed
in the future, without any further notice.
2019-04-22 01:09:28 -04:00
Glenn Strauss eee29b65e5 [mod_webdav] check If-Match, If-Unmodified-Since (#1818)
  "add RFC-compliant LOCK support to mod_webdav"
2019-04-22 01:09:23 -04:00
Glenn Strauss 3111e24b71 [mod_webdav] clean up resources after do{}while(0) 2019-04-22 01:08:58 -04:00
yangfl 4af0f97f14 [mod_webdav] fix misbehavior on blank nodes in PROPPATCH
github: #97

2019-04-22 01:08:58 -04:00
yangfl 6962fc2a5a [mod_webdav] fix uuid detection macro
github: #97

2019-04-22 01:08:58 -04:00
Glenn Strauss 993cb545d8 [mod_webdav] surround Lock-Token with "<...>"
(thx yangfl)

github: #97

2019-04-22 01:08:58 -04:00
Glenn Strauss 95aa2c178d [core] 200 for OPTIONS /non-existent/path HTTP/1.1 (fixes #2939)
200 for OPTIONS /non-existent/path HTTP/1.1 when a module,
such as mod_webdav, has set Allow response header

  "OPTIONS should return 2xx status for non-existent resources if Allow is set"
2019-04-22 01:08:58 -04:00
Glenn Strauss 50aae03c31 [mod_webdav] major rewrite (fixes #1818)
(occurred 3 years ago on experimental branch, and now ported forward)

robustness and performance improvements, including atomic updates on
individual files (e.g. for PUT, COPY, MOVE)

exclusive locks are fully supported
shared locks are partly supported

  "add RFC-compliant LOCK support to mod_webdav"
2019-04-22 01:08:54 -04:00
Glenn Strauss a15f40a569 [core] replace open() with fdevent_open_cloexec()
fdevent_open_cloexec() opens files O_BINARY for consistency,
and with O_NONBLOCK, so that the server will not block if the
target file to open is a fifo.
2019-04-20 02:10:28 -04:00
Glenn Strauss f1e9bcb08a [core] new worker_init hook to follow parent fork 2019-04-20 02:10:28 -04:00
Glenn Strauss 4183e723ce [core] log_error, log_perror using printf-like fmt 2019-04-20 02:10:28 -04:00
Glenn Strauss cbad7517c8 [core] struct log_error_st for error logging 2019-04-20 02:10:28 -04:00
Glenn Strauss 9eead7db7c [core] __attribute__((format ...)) 2019-04-20 02:10:28 -04:00
Glenn Strauss 0dccda28ad [core] add const to some etag prototypes 2019-04-20 02:10:28 -04:00
Mohammed Sadiq 6a988bb0d0 [multiple] cleaner calloc use in SETDEFAULTS_FUNC
github: closes #99

  "cleaner calloc use in SETDEFAULTS_FUNC"
2019-04-20 02:09:04 -04:00
Glenn Strauss 599b4f05c8 [core] fix 1.4.52 regression in mem use with POST (fixes #2948)
(thx rgenoud)

  "[regression][Bisected] lighttpd uses way more memory with POST since 1.4.52"
2019-04-20 02:06:43 -04:00
Glenn Strauss e757978497 [core] remove repeated slashes in http-parseopts
remove repeated slashes in server.http-parseopts
with url-path-dotseg-remove, including leading "//"

(prior to this patch, leading "//" was skipped)
2019-04-15 23:53:22 -04:00
Glenn Strauss 32120d5b8b [core] fix abort in http-parseopts (fixes #2945)
fix abort in server.http-parseopts with url-path-2f-decode enabled

(thx stze)

  "Security - SIGABRT during GET request handling with url-path-2f-decode enabled"
2019-04-10 11:36:28 -04:00
Glenn Strauss 107fa1f282 [mod_wstunnel] fix ping-interval for big-endian (fixes #2944)
fix for big-endian architectures

(thx ste_p_james)

  "[patch] ineffective"
2019-04-10 11:36:24 -04:00
Glenn Strauss b135b4d24d [core] clear FDEVENT_RDHUP if no POLLRDHUP
(fix for poll() on FreeBSD 11)
2019-03-16 17:38:40 -04:00
Glenn Strauss f2ac4cdfc5 [core] off_t upload_temp_file_size 2019-03-16 01:39:59 -04:00
Glenn Strauss a78404cfbf [core] fdevent_mkstemp_append() (shared) 2019-03-16 01:38:29 -04:00
Glenn Strauss 97d4c11ba6 [core] __attribute__((fallthrough)) for GCC 7.0 2019-03-16 01:37:23 -04:00
Glenn Strauss 1f7afa9c70 [doc] minor adjust regex match (#2942)
'-' in char class should be at beginning or end, or escaped with \-
so that it does not signify a char range in the char class

(In the prior regex, the misuse permitted matching the comma char,
which while mostly harmless, was not what was intended)

  "incorrect behaviour of"
2019-03-14 01:38:46 -04:00
Glenn Strauss f60f1a279e [core] extend dir redirection to take HTTP status
extend http_response_redirect_to_directory to take HTTP status code
and to set Location if HTTP status >= 300, or else set Content-Location
2019-03-13 02:29:31 -04:00
Glenn Strauss 5440f04e8a [core] fix assertion with server.error-handler (fixes #2941)
(thx andpr)

  "failed assertion on incoming bad request when server.error-handler option is used"
2019-03-13 00:48:26 -04:00
Glenn Strauss 37bd124ae4 [core] pass conf.follow_symlink in more places 2019-03-10 23:22:58 -04:00
Glenn Strauss 2f46736edc [build] remove -Wdeclaration-after-statement
Declarations after statements has been permitted since C99.
(That was 20 years ago!)
2019-03-09 23:20:21 -05:00
Glenn Strauss 8064b7483a [mod_magnet] fix invalid script return-type crash (fixes #2938)
(thx flynn)

  "Lighttpd crashes on wrong return type in lua script"
2019-03-07 00:32:17 -05:00