2
0
Fork 0
Commit Graph

481 Commits (7aec09dd27f12868708a95407029aaf71bf63e5e)

Author SHA1 Message Date
Stefan Bühler 7aec09dd27 [lua] split all metatable init/create code into separate functions
- lua_push_*_metatable and init_*_mt (init only used by push)

Change-Id: I42a3d58b884205f30e4ee9a99c693ce65e9dbf66
2021-08-05 13:55:29 +02:00
Stefan Bühler 4a4fd8fd11 [core] include and use hedley (v15) header
hedley is a single header to handle compiler-specific features:
https://nemequ.github.io/hedley/

Prefer headly macros over glib for now.

Change-Id: I3c67ebee0d43e27fde6402d47788e1045144e864
2021-08-05 12:29:46 +02:00
Stefan Bühler b41e02860c [mod_proxy] fall back to waiting for connection close if no message length indicator is found in HTTP/1.1 response
It seems this is actually allowed by the RFCs; although it is intended
as HTTP/1.0 backward compatibility, and HTTP/1.1 servers (backends)
really should do better.

Change-Id: I93265bfe7fae57beb10d70d3a4596c5cae7b51bd
2021-07-18 12:08:52 +02:00
Stefan Bühler 140a3c9018 fix refcount issue: don't drop rc in li_iostream_reset
... so li_stream_simple_socket_close doesn't need to acquire (when the rc might already be 0).

Instead call li_iostream_reset in all places that didn't acquire before,
and drop the acquire.

Change-Id: I347f49eb57989738ed811a1f3a31b8942ff32881
2021-05-03 23:24:48 +02:00
Stefan Bühler 424e1a37f8 [core] Reset con->out (response body) queue counters (used by mod_accesslog) for keep-alive
Change-Id: Id644a71c808c8a3c73e476fddb6022177de8dd5f
2021-02-28 12:38:33 +00:00
Stefan Bühler d544ee105d [core] docs say empty log targets request not logging; actually implement that (went to stderr)
Change-Id: If71dc0b309c4e8221ecef877202d9a1a571ad5c6
2021-02-28 13:28:00 +01:00
Stefan Bühler 76fccefc84 [core] encode path in li_vrequest_redirect_directory
To handle whitespace and ? (and other special chars).

Change-Id: Ie597c1d784d42dba70dd21650f5fc9770e9e6547
2020-06-22 20:36:58 +02:00
Stefan Bühler 51a7fd577c [core]: fix query string handling in li_vrequest_redirect_directory (dirlist, index)
- use decoded path instead of orig raw path (which includes the query
  string); the decoded path should be safe, and we also really don't
  need to support any "raw" handling - we're at the filesystem level
  anyway.

Change-Id: Ic9a5b362bea9813873631b18aaa908c59f2bb0a6
2020-06-22 20:27:41 +02:00
Stefan Bühler 505bfb053f [core] move CGI environment creation to core
Change-Id: Ia826381365a04352249321097fda57f704984821
2019-08-31 13:48:17 +02:00
Stefan Bühler afaf285bfb [core] fix chunk decoding bug: reused stale context after forwarding chunk data
Change-Id: Ie37e3c2d605ae23dcb7a6b74ff6b5f0699074ac5
2019-08-26 00:36:59 +02:00
Stefan Bühler 7078063491 [core] fix parsing of chunk digits
Change-Id: I8fd5b916172c432b63329078e261a8ed5eff23dc
2019-08-26 00:15:27 +02:00
Stefan Bühler a41b92eb8a [core] fix segfault in http response streaming
Change-Id: I61a0167d8a7fdede96075960f5099b33c0a8ab02
2019-08-25 19:25:02 +02:00
Stefan Bühler d8bd405a19 [core] fix crash when HTTP backend "Upgrade"s
Change-Id: If7143f49baa2efa8d1fb3f78c6390969730c678e
2019-08-25 13:07:49 +02:00
Stefan Bühler d167e6e416 [core/mod_proxy] support http backends trying to run keep-alive
Even if they shouldn't (due to HTTP/1.0 or Connection; close) some
backends send HTTP/1.1 without Connection: close, and use Content-Length
to signal end of response (and don't close the connection, as they wait
for another request).

Now Content-Length is used to find the end of the response (chunked
transfer-encoding was already supported).

mod_proxy now signals HTTP/1.1, but also sends "Connection: close": it
doesn't reuse the connection yet.

Change-Id: Ica0c9b3b7da79899412a746f21e7348ccd3d23ee
2019-08-25 11:45:18 +02:00
Stefan Bühler 52566836a0 [core] fix fallthrough annotation for gcc
Change-Id: I3130f87b0709055d1f496961f7bd8167329e2c46
2019-08-25 11:45:18 +02:00
Stefan Bühler 8643cafa22 [core] fix log level of connection: (backend) response header parsing
Change-Id: Idd8263ccf19bf60df10cf22fa8c7037615171c35
2019-08-24 23:35:40 +02:00
Stefan Bühler bda1a90f27 [core] add strict.post_content_length option
Change-Id: Ie9d67eceed7e957b667554925d562018a3217209
2018-09-08 23:12:22 +02:00
Stefan Bühler bc6b256c34 [core] use readdir instead of readdir_r
readdir_r is deprecated in glibc due to serious memory handling issues
in the API: one cannot pass the size of the allocated dirent.

glibc authors claims readdir is thread-safe in modern implementations,
and expect POSIX to require it in a future version.

No way to check whether readdir is thread-safe though :(

("thread-safe" in this context means different directory streams, which
is good enough.)

Also remove li_dirent_buf_size.

Change-Id: Ia5eae3327e97dc4b0751fb2604ea21c0ce09a5f9
2017-07-29 15:25:55 +02:00
Stefan Bühler e0e96ae377 [plugin_core] fix segfault in fetch.files_static init
Change-Id: Icbc8e1440ea35b80a25e600e4a1bd913cafc72f1
2017-07-26 08:16:36 +02:00
Stefan Bühler 808cdf301b handle ENAMETOOLONG in various places
- ENAMETOOLONG:
  - static, flv: return 414
  - dirlist, pathinfo: treat as not-existing (i.e. no handling)
- also return 500 instead of closing the connection when stat/open
  fails an unhandled error
- explicit return instead of switch-case fallthrough (no semantic
  change) in actions.c

Change-Id: I1e2dd721dd18544500b4436ada843cb6e7f2db72
2017-05-20 15:48:36 +02:00
Stefan Bühler f6990a9d8a [plugin_core] support patterns in alias target
Change-Id: Ic77080dc5d7e1821832d10b56366cc79d0ff8a6a
2017-05-12 13:32:32 +02:00
Stefan Bühler 6a0e57ec8f [parsers] fix unused variable warnings
Change-Id: Ifc0210235ada102e2dbcba23e1179e87b973510f
2016-08-27 11:32:23 +02:00
Stefan Bühler 130f14a3ea [config] expect exactly one comma between list entries
- the parser didn't require a comma before, and accepted multiple ones
- comma at end of list still optional

Change-Id: I4bb07ceed9aaceb43a14f7eeb5d364d6718e7acc
2015-12-04 14:17:29 +01:00
Stefan Bühler 3a4698d6b9 [pattern] fix all calls of li_pattern_eval to provide latest regex match
Change-Id: I7aeaf908eab9da3fe24e9871f648e3fd58fddbe1
2015-12-04 13:36:27 +01:00
Stefan Bühler f527a16138 [debug] provide more unique event names for waitqueues
Change-Id: Iddf9e10b3902fbfe4fa7e97b7a172018d0d70b54
2015-08-09 10:12:21 +02:00
Stefan Bühler 535f6b4afb [streams] improve stream handling, hopefully fixes bug with lingering backend connections
- reset backend_source before backend_drain; first tell the backend we
  are not interested in data anymore, then force closing the outgoing
  data
- as backend_drain might get reopened for a Connection: upgrade, the
  backend cannot rely on backend_drain->out.is_closed, but waits for a
  disconnect (which will also release the last reference).  the same is
  done for backend_source, so a backend can just wait for both reference
  counts to drop to zero before actually closing the backend connection
  (unless it keeps the streams alive itself).

Change-Id: Ibfe7985debd71580dbb78b985abaf946f59e3024
2015-08-08 16:12:59 +02:00
Stefan Bühler 4375aba174 [request parser] adapt whitespace removal from response parser, fixes bug removing last character if CR was missing
Change-Id: Idd39363b460f1141aa2bebde187f3ca10a7bb344
2015-08-06 23:19:37 +02:00
Stefan Bühler b37d95facf [lua] handle filter->vr == NULL in lua filters, handle filter->in == NULL in xsendfile
Change-Id: I5326ce72f1b45bf0b64194e6ec8935b6261d18d2
2015-06-13 22:57:54 +02:00
Stefan Bühler 66bd6b22a2 track event "names" for debugging
Change-Id: Ib8f2b589a6087de2355906a87bd2cd0c84bafcba
2015-01-17 15:16:29 +01:00
Stefan Bühler 10305546cb [core] close out stream nicely on regular shutdown (fixes openssl session problem)
Change-Id: Iaac73fa64c03225751c4492b5c690094f3d6e97f
2014-12-22 15:11:31 +01:00
Stefan Bühler 72011fbede [mox_rewrite,mod_proxy,docs] fix request.raw_path handling (includes query-string) 2014-06-06 13:41:30 +02:00
Stefan Bühler 4c741ce853 [core] expose request.raw_path as condition variable 2014-06-06 11:16:22 +02:00
Stefan Bühler d58d98a62d [value] move value functions that depend on angel / main implementations into separate file, included in the other implementations
this fixes building with --no-undefined. also link with libm in cmake.
2014-05-22 14:58:26 +02:00
Stefan Bühler b6ee9241ad [angel_fake] use li_sockaddr_from_string in li_angel_fake_listen 2014-04-15 13:05:52 +02:00
Stefan Bühler 5f4019359e [config parser] copy fixes from angel config parser 2014-04-15 12:41:09 +02:00
Stefan Bühler 63f4b78353 fix some socket address handlings - limit unix socket path names to struct size 2014-04-15 12:06:11 +02:00
Stefan Bühler 5b706ac033 [simple-stream] fix double assignment 2014-04-15 11:30:36 +02:00
Stefan Bühler 3ad9e4cb01 [actions] fix dereference before null check 2014-04-15 11:13:20 +02:00
Stefan Bühler acd2967534 assert many previously unchecked return values, handle some explicitly, remove FD_CLOEXEC in worker - mustn't fork 2014-04-15 11:11:51 +02:00
Stefan Bühler 17a5168793 [core] convert all assert() to LI_FORCE_ASSERT(), and support writing backtraces on fatal errors with libunwind 2014-04-11 11:40:24 +02:00
Stefan Bühler 01788a7250 [common] remove hash value type (use key/value lists instead) 2014-04-10 12:40:08 +02:00
Stefan Bühler b5edda3bf4 [plugin_core] fix index "/filename" handling 2014-02-26 13:18:30 +01:00
Stefan Bühler ec6600271a [config] fix conditional parsing
conditional expressions include values to compare with; any
  complicated value expression must be put into parantheses.
  -> stop parsing after a simple value, don't search for operators,
     "and"/"or" operators are handled by the conditional
2014-02-10 15:33:48 +01:00
Stefan Bühler db58828e0b [common] refactor liValue to share most of the code
* removing unused "range" value type in angel
2014-02-06 14:01:20 +01:00
Stefan Bühler d529150a9b [autotools] remove generated ragel parsers from dist 2014-02-04 13:22:01 +01:00
Stefan Bühler c3b715dae1 remove old test file 2014-02-04 13:01:23 +01:00
Stefan Bühler f482877825 [doc] document core config and modules in tree 2014-02-03 12:57:25 +01:00
Stefan Bühler a6303d8baa [config] allow setting vars in setup block 2013-11-13 23:49:08 +01:00
Stefan Bühler 0d40b25d19 [config] fix missing reference (segfault on shutdown) 2013-09-10 16:05:13 +02:00
Stefan Bühler 7d22354772 [config] fix cast(string) 2013-09-10 15:22:58 +02:00