Commit Graph

2511 Commits (da6b2dc1b6d1f1f975b0475d44b53dcbe8fcb0e6)
 

Author SHA1 Message Date
Glenn Strauss 1465cf80f9 [core] calloc plugin_config for consistent init 6 years ago
Glenn Strauss 9c0ef6876d [core] permit strings,ints,arrays in config array
(modules may implement more particular restrictions)

x-ref:
  "[mod_proxy] forwarded is a string array only"
  https://github.com/lighttpd/lighttpd1.4/pull/80
6 years ago
Glenn Strauss b23065e547 [mod_accesslog] flag high precision ts for %T (fixes #2807)
flag high precision ts for %T after parsing %{xxx}T config

x-ref:
  "%D and %{UNIT}T of mod_accesslog do not work as expected"
  https://redmine.lighttpd.net/issues/2807
6 years ago
Glenn Strauss 45bb2c1f59 [core] permit strings and integers in config array
(modules may implement more particular restrictions)

github: closes #80
6 years ago
Gaël PORTAY 589faeef63 [core] fix build issue without ipv6 support
This patch fixes the build issue introduced with when code has been
shared in commit a448886485.

	http-header-glue.c: In function 'http_cgi_headers':
	http-header-glue.c:1555:39: error: 'b2' undeclared (first use in this function)
	http-header-glue.c:1555:39: note: each undeclared identifier is reported only once for each function it appears in

github: closes #79
6 years ago
Glenn Strauss 40f72a41b9 [core] omit default port from normalized host str
omit default scheme port from normalized host string
6 years ago
Glenn Strauss 440b371997 [mod_proxy] fix backslash escaping
(thx gportay)
6 years ago
Glenn Strauss 2986221cab [core] sys-strings.h abstraction for strings.h 6 years ago
Glenn Strauss 05c34ce464 [core] buffer_substr_replace() 6 years ago
Glenn Strauss ac143ead29 [core] inline simple buffer is empty checks 6 years ago
Glenn Strauss 8641d1b03f [core] no SOCK_CLOEXEC on Linux kernel < 2.6.27
Linux kernels < 2.6.27 (old!) might return EINVAL if SOCK_CLOEXEC used

x-ref:
  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=529929
  http://www.linksysinfo.org/index.php?threads/lighttpd-no-longer-starts-toastman-1-28-0510-7.73132/
6 years ago
Glenn Strauss 9e46b8ea25 [core] extend mimetype search w/o leading '.'
repeat extension search without leading '.' to handle situation
where admin configured mimetype.assign keys without leading '.'
6 years ago
Glenn Strauss a434a3fab0 [mod_openssl] free local_send_buffer at exit 6 years ago
Glenn Strauss ba679290f9 [core] inet_ntop_cache now 4-element cache
(round-robin replacement; fixes what was effectively a 1-element cache)
6 years ago
Glenn Strauss 0cc7556aec [core] perf: stat_cache_mimetype_by_ext()
shared code to get mimetype string via longest extension match
(attempts to match file basename, then longest ext, then "")

Note: this is a behavior change from simple suffix match
      if there are 16 or more entries in mimetypes.assign
6 years ago
Glenn Strauss 8e97c84c0f [core] fix stat_cache initialization error
fix stat_cache initialization error (coverity identified memory leak)
  (bug introduced when moving stat_cache_init code from server.c to
   stat_cache.c)

quell insignificant coverity warning in mod_extforward
6 years ago
Glenn Strauss bd0b2592d1 [mod_extforward] fix typos in Forwarded handling
also: add commented-out code for potentially creating X-Forwarded-For
from Forwarded, if X-Forwarded-For is not present.
6 years ago
Glenn Strauss 78cc72726d [mod_extforward] support HAProxy "PROXY" protocol (fixes #2804)
experimental support to receive requests via HAProxy "PROXY" protocol

x-ref:
  "The PROXY protocol - Versions 1 & 2"
  http://www.haproxy.org/download/1.8/doc/proxy-protocol.txt
  "support (HAProxy) PROXY protocol for receiving requests"
  https://redmine.lighttpd.net/issues/2804
6 years ago
Glenn Strauss e33ec75999 [core] save connection-level proto in con->proto
The per-request scheme starts with con->proto (e.g. "http")
and can later be changed per-request by mod_extforward or mod_magnet
6 years ago
Glenn Strauss a448886485 [core] inet_pton(), inet_ntop() on (sock_addr *)
shared code to provide inet_pton() and inet_ntop() behavior on
lighttpd (sock_addr *) and (buffer *) data structures.
6 years ago
Glenn Strauss b2e2d42c83 [mod_proxy] support Forwarded HTTP Extension (fixes #2703)
To enable "Forwarded", must enable which params to include.
The recommended set is "for" and "proto" unless other params
are required and proper security precautions have been taken.
proxy.forwarded = ( "for" => 1,
                    "proto" => 1,
                    #"host" => 1,
                    #"by" => 1,
                    #"remote_user" => 1,
                  )

See https://tools.ietf.org/html/rfc7239 for info about "Forwarded"

x-ref:
  "Forwarded HTTP Extension"
  https://tools.ietf.org/html/rfc7239
  "Forward authenticated user to proxied requests"
  https://redmine.lighttpd.net/issues/2703
6 years ago
Glenn Strauss 371e1bf723 [mod_extforward] support Forwarded HTTP Extension (#2703)
enable with, e.g.:
extforward.headers = ( "Forwarded" )
or
extforward.headers = ( "Forwarded", "X-Forwarded-For" )
or
extforward.headers = ( "Forwarded", "X-Forwarded-For", "Forwarded-For" )

The default remains:
extforward.headers = ( "X-Forwarded-For", "Forwarded-For" )

Support for "Forwarded" is not enabled by default since intermediate
proxies might not be aware of Forwarded, and might therefore pass
spoofed Forwarded header received from client.

extforward.params = ( # overwrite "Host" with Forwarded value
                      #"host" => 1
                      # set REMOTE_USER with Forwarded value
                      #"remote_user" => 1
                    )
Note: be cautious configuring trusted proxies if enabling these options
since Forwarded header may be spoofed and passed along indescriminantly
by proxies which do not handle Forwarded.

To remove "Forwarded" from incoming requests, do not enable these
options and instead use mod_setenv to clear the request header:
  setenv.set-request-header = ( "Forwarded" => "" )

Other proxy-related headers which admin might evaluate to keep or clear:
  setenv.set-request-header = ( "X-Forwarded-For" => "",
                                "X-Forwarded-By" => "",
                                "X-Forwarded-Server" => "",
                                "X-Origin-IP" => "",
                                "Via" => "",
                                #...
                              )

x-ref:
  "Forwarded HTTP Extension"
  https://tools.ietf.org/html/rfc7239
  "Forward authenticated user to proxied requests"
  https://redmine.lighttpd.net/issues/2703
6 years ago
Glenn Strauss 36adf0d9a6 [mod_extforward] rearrange code; prep Forwarded 6 years ago
Glenn Strauss 3070972335 [mod_extforward] upd scheme after ipstr validated 6 years ago
Glenn Strauss e7ee5dbf78 [mod_extforward] consolidate ipstr_to_sockaddr() 6 years ago
Glenn Strauss c3c78599dd [mod_extforward] simplify header search 6 years ago
Glenn Strauss 1104afc49b [core] export http_request_host_policy() for reuse 6 years ago
Glenn Strauss 162e754d0d [core] report file path when mkstemp() fails (fixes #2802)
x-ref:
  "Could the error-log be improved a tiny bit in regards to "Permission denied" errors"
  https://redmine.lighttpd.net/issues/2802
6 years ago
Glenn Strauss 8cf6e908d3 [core] include <netdb.h> where needed
include <netdb.h> in files which use getaddrinfo()
  instead of exposing header in local header "sys-socket.h"
6 years ago
Glenn Strauss 4796313efc [core] collect ioctl FIONREAD code
include <sys/ioctl.h> in files which use ioctl()
  instead of exposing header in local header "sys-socket.h"
6 years ago
Glenn Strauss e116479731 [core] make stat_cache private to stat_cache.c 6 years ago
Glenn Strauss ba953cdf45 [core] include "fdevent.h" where needed
(instead of providing #include "fdevent.h" in base.h)
6 years ago
Glenn Strauss 20ed025685 [core] use con->dst_addr_buf instead of ip recalc
use con->dst_addr_buf over inet_ntop_cache_get_ip(srv, &(con->dst_addr))
6 years ago
Glenn Strauss a53f662a30 [core] remove some unused header includes
remove exposure of stdio.h in buffer.h for print_backtrace(), now static
6 years ago
Glenn Strauss 14890c1c89 [core] remove redundant Content-Length digit check 6 years ago
Glenn Strauss 4115266792 [mod_proxy] set X-Forwarded-Host (fixes #418)
lighttpd appends the request "Host" to the non-standard header "X-Host"
when acting as a reverse proxy.  This patch additionally appends "Host"
to the non-standard header "X-Forwarded-Host" to match the convention in
some other web servers

x-ref:
  "mod_proxy should send the X-Forwarded-Host header to the proxied server"
  https://redmine.lighttpd.net/issues/418
6 years ago
Glenn Strauss 37261bbd7e [mod_proxy] set Content-Length, if available
set Content-Length if client sent Transfer-Encoding: chunked
and not streaming to backend (request body has been fully received)
6 years ago
Philip Prindeville 367e62c1c2 [core] allow overriding prior config values (fixes #2799)
introduce ":=" config file syntax to replace previously set value

github: closes #78

x-ref:
  "allow overriding configuration values"
  https://redmine.lighttpd.net/issues/2799
  https://github.com/lighttpd/lighttpd1.4/pull/78
6 years ago
Glenn Strauss ad6c703a51 [core] server.syslog-facility (use -1 for unset) (#2800)
(thx philipp)

x-ref:
  "lighttpd needs config option for syslog facility"
  https://redmine.lighttpd.net/issues/2800
6 years ago
Glenn Strauss a8561450a5 [core] server.syslog-facility (fixes #2800)
server.syslog-facility = "daemon"

x-ref:
  "lighttpd needs config option for syslog facility"
  https://redmine.lighttpd.net/issues/2800
6 years ago
Glenn Strauss aa14493e47 [tests] reduce time waiting for backends to start
reduce time spent waiting for backends to start

tests check for active listening port before proceeding

test runs now complete in about 2/3 the time
6 years ago
Glenn Strauss 1804ccbd6d [mod_scgi] do not reconnect after connect succeeds
apply diff from commit:2eaf42d0 made to mod_fastcgi.c back in 2009

(change is being made for (a bit more) consistency between the modules
 as mod_scgi.c was forked from mod_fastcgi.c a very long time ago, as
 well as to remove call to sleep for 10ms (usleep(10000) from mod_scgi)

x-ref:
  "fastcgi incomplete header might crash lighty"
  https://redmine.lighttpd.net/issues/2096
6 years ago
Glenn Strauss 3b7ab403be [mod_cgi] eliminate warning when compiled -Os 6 years ago
Glenn Strauss a22c126323 [core] remove now-unused buffer_search_string_len
(just use strstr(), if desired)
6 years ago
Glenn Strauss 0a635fc8be [core] consolidate dynamic handler response parse
- consolidate dynamic handler HTTP response parsing code
- reduce string copies for CGI, FastCGI, SCGI, proxy response headers
- let read() signal EOF or EAGAIN instead of ioctl FIONREAD 0-data-ready
6 years ago
Glenn Strauss 76ad82434f [mod_proxy] remove use of con->got_response 6 years ago
Glenn Strauss 0ec41d6d80 [core] remove unused member con->in_joblist 6 years ago
Glenn Strauss 1485cb401b [core] fix crash if invalid config file (fixes #2798)
If lighttpd.conf is invalid, some modules may not have initialized their
per-context config structures, but will have their free-functions
called, which should not be run on uninitialized per-context configs.

x-ref:
  "Segfault with simple-vhost.debug = "enable""
  https://redmine.lighttpd.net/issues/2798
6 years ago
Glenn Strauss 46ff978fa0 [doc] simple-vhost.debug takes an integer value (fixes #2797) 6 years ago
Glenn Strauss 83759aede6 [mod_auth] Digest nonce on system with time <=1978
On systems with time prior to Jul 4 1978 21:24:15,
the hex string of the timestamp is fewer than 8 chars.

(thx daveoman)
6 years ago