Commit Graph

2602 Commits (255269d799185186bda64c04bf7a2efeeffbb8d6)
 

Author SHA1 Message Date
Glenn Strauss 255269d799 [mod_redirect,mod_rewrite] encoding options (fixes #443, fixes #911)
Provide means to encode redirect and rewrite backreference substitutions
  In addition to $1 and %1, the following modifiers are now supported,
  followed by the number for the backreference, e.g. ${esc:1}

  ${noesc:...}  no escaping
  ${esc:...}    escape all non-alphanumeric - . _ ~ incl double-escape %
  ${escape:...} escape all non-alphanumeric - . _ ~ incl double-escape %
  ${escnde:...} escape all non-alphanumeric - . _ ~  but no double-esc %
  ${tolower:...}
  ${toupper:...}

  %{noesc:...}
  %{esc:...}
  %{escape:...}
  %{escnde:...}
  %{tolower:...}
  %{toupper:...}

Provide means to substitute URI parts without needing a regex match
  (and can be preceded by encoding modifier,
     e.g. ${tolower:url.authority})

  ${url.scheme}
  ${url.authority}
  ${url.port}
  ${url.path}
  ${url.query}

  ${qsa}        appends query string, if not empty

x-ref:
  "[PATCH] mod_redirect: Add support for url-encoding backreferences, map %%n->%n, $$n->$n"
  https://redmine.lighttpd.net/issues/443
  "Need for URL encoding in mod_redirect and possibly mod_rewrite"
  https://redmine.lighttpd.net/issues/911
5 years ago
Glenn Strauss 37900d24b3 [mod_redirect,mod_rewrite] pass request URI info 5 years ago
Glenn Strauss 1f6befbd66 [mod_cgi] handle CGI partial response header write
handle CGI partial write of first response header

e.g. gSoap stdsoap2.c might inefficiently write "Status" to response
pipe and lighttpd might read that prior to the backend writing the
subsequent ": " which marks "Status:" as a response header.

x-ref:
  https://redmine.lighttpd.net/boards/2/topics/8028
5 years ago
Glenn Strauss 2e385a1a53 [core] fix buffer_to_upper()
fix buffer_to_upper() and case-insensitive filesystem detection
5 years ago
Glenn Strauss 1c68589c67 [mod_redirect,mod_rewrite] short-circuit earlier
short-circuit earlier if there are no rules to be matched
5 years ago
Glenn Strauss bad1cfe059 [core] debug server.log-request-header-on-error
enable server.log-request-header-on-error when either
server.log-request-handling or server.log-request-header
are enabled in the global scope.

server.log-request-header-on-error is a global directive since it must
be set prior to parsing of request, and errors parsing request might
otherwise occur before lighttpd config conditions are parsed and set
(i.e. based on the parsed request headers)

x-ref:
  "Log error if Host name is illegal (e.g. contains an underscore)"
  https://redmine.lighttpd.net/issues/2885
5 years ago
Glenn Strauss a8aa39c699 [core] remove some duplicative code in log.c 5 years ago
Glenn Strauss 6ebd289788 [core] inline some buffer.[ch] routines 5 years ago
Glenn Strauss 3eb7902e10 [core] server.http-parseopts URL normalization opt (fixes #1720)
server.http-parseopts = ( ... ) URL normalization options

Note: *not applied* to CONNECT method

Note: In a future release, URL normalization likely enabled by default
  (normalize URL, reject control chars, remove . and .. path segments)
  To prepare for this change, lighttpd.conf configurations should
  explicitly select desired behavior by enabling or disabling:
    server.http-parseopts = ( "url-normalize" => "enable", ... )
    server.http-parseopts = ( "url-normalize" => "disable" )

x-ref:
  "lighttpd ... compares URIs to patterns in the (1) url.redirect and (2) url.rewrite configuration settings before performing URL decoding, which might allow remote attackers to bypass intended access restrictions, and obtain sensitive information or possibly modify data."
  https://www.cvedetails.com/cve/CVE-2008-4359/
  "Rewrite/redirect rules and URL encoding"
  https://redmine.lighttpd.net/issues/1720
5 years ago
Glenn Strauss 6ccccaaa38 [tests] move src/test_*.c to src/t/ 5 years ago
Glenn Strauss a46bc4f5de [core] remove proc_open.[ch], reduce stdio.h use 5 years ago
Glenn Strauss fb5a33ffe9 [core] remove unused get_http_status_body_name() 5 years ago
Glenn Strauss c56b21084e [core] http_kv.[ch] method, status, version str
move method, status, version strings from keyvalue.[ch] to http_kv.[ch]
5 years ago
Glenn Strauss 1b62dc325c [tests] test_request unit tests
unit tests for request processing
collect existing request processing tests from Perl tests/*.t
(test_request.c runs *much* more quickly than Perl tests/*.t)
5 years ago
Glenn Strauss e8c1efd5df [core] data_config_pcre_compile,exec()
collect PCRE usage related to config processing
5 years ago
Glenn Strauss cf9474aa2c [mod_redirect, mod_rewrite] code reuse (sharing) 5 years ago
Glenn Strauss 22f3f43621 [core] CONNECT must be handled before fs hooks
do not permit CONNECT requests to hit filesystem hooks
since the CONNECT URI bypasses path normalization
5 years ago
Glenn Strauss 83cdf28610 [core] check for continuation in server.tag
check server.tag for newlines (not expected) and ensure proper
header continuation.

remove buffer_append_string_encoded() ENCODING_HTTP_HEADER
(continuations in response headers handled in response_header_*() funcs)
5 years ago
Glenn Strauss 132c1b6019 [tests] remove test_buffer output, except on error 5 years ago
Glenn Strauss 1cef8dfc05 [tests] reduce test_base64 brute force tests
It is not necessary to test every single value of 3 chars for confidence
in the tests.  256^256^256 is a bit overkill (and much more time
consuming than other tests)
5 years ago
Glenn Strauss 1593190651 [core] buffer_append_string_encoded() uc hex
Use uc hex chars in buffer_append_string_encoded(), preferred in RFC3986

Preserve behavior using lc hex chars in buffer_append_string_c_escaped()
5 years ago
Glenn Strauss 3d880810d1 [core] buffer_append_uint_hex_lc() uses lc hex 5 years ago
Glenn Strauss d3cf141d14 [core] li_tohex_lc() explicitly uses lc hex chars
remove buffer_copy_string_hex()
5 years ago
Glenn Strauss 5e60b8faea [mod_secdownload] compare bin MAC instead of hex 5 years ago
Glenn Strauss 9eda625d67 [core] more efficient hex2int() 5 years ago
Glenn Strauss 936db51f05 [core] buffer_append_string_encoded_hex_lc()
special-purpose routine is more efficient than what was previously in
buffer_append_string_encoded() with ENCODING_HEX
5 years ago
Glenn Strauss 78024584bb [core] check if SOCK_NONBLOCK is ignored (fixes #2883)
x-ref:
  "fdevent_init should check if SOCK_NONBLOCK works"
  https://redmine.lighttpd.net/issues/2883
5 years ago
Glenn Strauss 3efaff973f [mod_fastcgi,mod_scgi] fastcgi.balance,scgi.balance (fixes #2882)
x-ref:
  "fastcgi.balance not working"
  https://redmine.lighttpd.net/issues/2882
5 years ago
Glenn Strauss b70186131a [mod_magnet] reduce buffer copies
reduce buffer copies, but leave where (buffer *) arg required
5 years ago
Glenn Strauss 4753064318 [mod_magnet] code reuse 5 years ago
Glenn Strauss 6fb023d664 [mod_wstunnel] better Sec-WebSocket-Protocol parse
Improve handling of Sec-WebSocket-Protocol: binary, base64 for RFC6455.
When client sends Sec-WebSocket-Protocol in request header, client
may expect Sec-WebSocket-Protocol response.  mod_wstunnel is basic
tunnel endpoint and supports "binary" and "text" modes for RFC6455,
conventionally requested by client browsers as "binary" or "base64"
5 years ago
Glenn Strauss 04d76e7afd [core] some header cleanup
provide standard types in first.h instead of base.h
provide lighttpd types in base_decls.h instead of settings.h
reduce headers exposed by headers for core data structures
  do not expose <pcre.h> or <stdlib.h> in headers
move stat_cache_entry to stat_cache.h
reduce use of "server.h" and "base.h" in headers
5 years ago
Glenn Strauss fefc82153a [build] remove m4 AC_PATH_PROG for PKG_CONFIG
replaced by PKG_PROG_PKG_CONFIG and PKG_CHECK_MODULES()
5 years ago
Glenn Strauss d400f8aac5 [core] fdevent_accept_listenfd() nonblock cloexec
fdevent_accept_listenfd() now always returns fd O_NONBLOCK O_CLOEXEC
for consistency, rather than setting elsewhere in connection_accepted()

Handle older Linux 2.6 kernels which might have accept4() in glibc,
but return ENOSYS, as accept4() was not added until Linux kernel 2.6.28.
5 years ago
Glenn Strauss 26fb8d3ee6 [mod_proxy] fix segfault in Set-Cookie reverse map (fixes #2879)
fix segfault in reverse url-path mapping of Set-Cookie sent from backend
when proxy.header = ( "map-urlpath" => ( ... ) ) is used and there are
multiple Set-Cookie response headers with path= attributes which need to
be reverse mapped.

(thx ganto)

x-ref:
  "Segfault with proxy-header map-urlpath"
  https://redmine.lighttpd.net/issues/2879
5 years ago
Glenn Strauss 210b57708e [core] fix rare race condition from backends (fixes #2878)
fix rare race condition from backends with server.stream-response-body=2

(thx abelbeck)

x-ref:
  "fastcgi and stream-response-body=2 hangs on last chunk"
  https://redmine.lighttpd.net/issues/2878
5 years ago
Glenn Strauss 957916a90e [core] minor code cleanup in gw_recv_response() 5 years ago
Glenn Strauss 86f64a0288 [mod_magnet] fix regression in lighty.stat (fixes #2877)
fix regression in mod_magnet lighty.stat introduced in lighttpd 1.4.49
in commit commit:b1df38ab

x-ref:
  "lighty.stat failure"
  https://redmine.lighttpd.net/issues/2877
5 years ago
Glenn Strauss e21906b3b4 [core] fix crash if 'host' empty in config (fixes #2876)
x-ref:
 "segfault with fastcgi app"
  https://redmine.lighttpd.net/issues/2876
5 years ago
Glenn Strauss 78e25f0f50 [mod_extforward] allow explict IPs to be untrusted (#2860)
Allowing explicit IPs to be rejected might be useful in situations
where an internal network is to be allowed by CIDR mask, but there are
a small number of untrusted hosts on the network, e.g. hosts behind a
NAT to which some external ports are forwarded.

CIDR masks must be marked "trust", or else are ignored with a warning.

x-ref:
  "RFE: mod_extforward CIDR support"
  https://redmine.lighttpd.net/issues/2860
5 years ago
Glenn Strauss ae54806dc2 - next is 1.4.50 5 years ago
Glenn Strauss d0d5d4267b [doc] NEWS 5 years ago
Glenn Strauss 758d24142b [core] fix incorrect hash algorithm impl
fix incorrect implementation of djb hash algorithm
5 years ago
Glenn Strauss 5a6e4df85c [mod_auth] check that digest realm matches config 5 years ago
Glenn Strauss 81b7e8e2fb [mod_auth] constant time compare plain passwords
(digests have same length)
5 years ago
Glenn Strauss 7265c72b6c [autoconf] reduce minimum automake version to 1.13
Although removal of AM_PROG_CC_C_O in f107bac8 requires automake 1.14
to provide the same functionality in AC_PROG_CC, any widely used,
modern compiler supports cc -c -o.  Reducing the minimum required
automake version avoids the current need for Centos 7 maintainers
to patch configure.ac in order to build binary packages.
5 years ago
Glenn Strauss 4a674224ab [core] re-enable overloaded backends w/ multi wkrs
re-enable overloaded backends when server.max-worker is non-zero

(thx jens-maus)

x-ref:
  "mod_proxy not re-enabling proxy with 1.4.48" (multiple workers)
  https://redmine.lighttpd.net/boards/2/topics/7906
5 years ago
Glenn Strauss fc7edb3946 [mod_extforward] CIDR support for trusted proxies (fixes #2860)
x-ref:
  "RFE: mod_extforward CIDR support"
  https://redmine.lighttpd.net/issues/2860
5 years ago
Glenn Strauss cd2b51cb1a [core] fix CONNECT w strict header parsing enabled
fix CONNECT with strict header parsing enabled (default)
(or set server.http-parseopt-header-strict = "disabled")

x-ref:
  "ssh over https tunnel"
  https://redmine.lighttpd.net/boards/2/topics/7805
5 years ago
Glenn Strauss bd32f67046 [core] open additional fds O_CLOEXEC 5 years ago