1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-01 07:26:57 +03:00

149 Commits

Author SHA1 Message Date
61db0638bf mod_lua: Make r.ap_auth_type writable
This completes the option of setting the remote user by the authentication
mechanism which actually verified the user.

One possible usecase is that a proxied (upstream) server performs the
authentication, but the access log of HTTPd does not contain this information.
The upstream server can pass this kind of information back to HTTPd and both
servers will have consistent access logs.

Submitted by: Michael Osipov <michaelo apache.org>
PR: 62497
Github: closes #67


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1921260 13f79535-47bb-0310-9956-ffa450edef68
2024-10-11 16:20:44 +00:00
67c65983d5 mpm_event,mod_http2,mod_status: Follow up to r1918257: CONN_STATE_ASYNC_WAITIO.
Per discussion on PR #449, have a separate state for returning the connection
to the MPM to wait for an IO (namely CONN_STATE_ASYNC_WAITIO), rather than
(ab)using CONN_STATE_PROCESSING.

This removes the need for AGAIN added in r1918257 (for now), and AP_MPMQ_CAN_AGAIN
is renamed to AP_MPMQ_CAN_WAITIO.

This is also the state that mod_status accounts for, so rename ->processing
to ->wait_io in process_score (shows as "wait-io" in mod_status and mod_lua).



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1918482 13f79535-47bb-0310-9956-ffa450edef68
2024-06-21 09:48:12 +00:00
d821182d76 mpm_event, mod_status: Separate processing and write completion queues.
As a follow up to r1918022 which handled the new CONN_STATE_PROCESS(ing) and
existing CONN_STATE_WRITE_COMPLETION in the same async queue, let's now have
two separates ones which allows more relevant async accounting in mod_status.

Rename CONN_STATE_PROCESS to CONN_STATE_PROCESSING as it's how it will be
called in mod_status.

* include/ap_mmn.h:
  MMN minor bump for process_score->processing counter.

* include/httpd.h:
  Rename CONN_STATE_PROCESS to CONN_STATE_PROCESSING.

* include/scoreboard.h:
  Add process_score->processing field.

* include/httpd.h, modules/http/http_core.c, modules/http2/h2_c1.c,
    server/mpm/event/event.c, server/mpm/motorz/motorz.c,
    server/mpm/simple/simple_io.c:
  Rename CONN_STATE_PROCESS to CONN_STATE_PROCESSING.

* server/mpm/event/event.c:
  Restore write_completion_q to handle connections in CONN_STATE_WRITE_COMPLETION.
  Use processing_q (renamed from process_q) solely for CONN_STATE_PROCESSING.
  Update process_score->processing according to the length of processing_q.
  
* modules/generators/mod_status.c:
  Show the value of process_score->processing in the stats.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1918098 13f79535-47bb-0310-9956-ffa450edef68
2024-06-01 15:08:46 +00:00
11a3fcbf9e use filters consistently
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1901502 13f79535-47bb-0310-9956-ffa450edef68
2022-06-01 12:36:13 +00:00
0c2910f074 cast first
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1901496 13f79535-47bb-0310-9956-ffa450edef68
2022-06-01 12:29:46 +00:00
5f4978a14a * Avoid "may be uninitialized" warning
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1898731 13f79535-47bb-0310-9956-ffa450edef68
2022-03-08 13:01:25 +00:00
3e561918fb mod_lua: Error out if lua_read_body() or lua_write_body() fail.
Otherwise r:requestbody() or r:parsebody() failures might go unnoticed for
the user.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1898689 13f79535-47bb-0310-9956-ffa450edef68
2022-03-07 14:07:02 +00:00
e1a199e8fd * Improve error handling
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1895970 13f79535-47bb-0310-9956-ffa450edef68
2021-12-15 08:28:11 +00:00
8e9ac92fe7 add r/o iterable tables
The current apr tables exposed support get/set but we cannot get the keys
or iterate. add _table() alternatives




git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1872455 13f79535-47bb-0310-9956-ffa450edef68
2020-01-07 19:18:13 +00:00
d844a8e128 Fix comment in mod_lua and docs.
s/addoutputfilter/add_output_filter/
See PR 62359

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1837404 13f79535-47bb-0310-9956-ffa450edef68
2018-08-04 07:47:47 +00:00
c7c68752c8 Fix PR54848 in a 2.4.x backportable format. Ideally deprecating the use
of ->client in whatever version of 2.4 this is added into would be
more logical.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1837225 13f79535-47bb-0310-9956-ffa450edef68
2018-08-01 11:27:28 +00:00
3e56c5b221 Fix some typos reported in PR 59998
Most add already been fixed when PR 59990 had been applied on trunk. 

Thx klemens

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1827669 13f79535-47bb-0310-9956-ffa450edef68
2018-03-24 20:05:19 +00:00
fe1923bb91 Fix new compilation breakage in mod_lua.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1800830 13f79535-47bb-0310-9956-ffa450edef68
2017-07-04 21:48:41 +00:00
d98ec3b059 More mod_lua compat for Lua 5.1, 5.2, 5.3.
One last use of luaL_register() with a non-NULL
"name" argument remaining.

Not tested yet.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1800815 13f79535-47bb-0310-9956-ffa450edef68
2017-07-04 20:35:06 +00:00
d1105fd4f2 mod_lua: Improve compatibility with Lua 5.1, 5.2 and 5.3.
PR58188, PR60831, PR61245.

Still to solve: replace uses of luaL_register().


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1800809 13f79535-47bb-0310-9956-ffa450edef68
2017-07-04 19:22:23 +00:00
e6459db019 Save a few bytes in the request pool.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1783057 13f79535-47bb-0310-9956-ffa450edef68
2017-02-15 03:52:57 +00:00
cc97ce3e52 https://bz.apache.org/bugzilla/show_bug.cgi?id=58855
Optimize check for empty strings


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1778067 13f79535-47bb-0310-9956-ffa450edef68
2017-01-09 22:08:01 +00:00
f439615d29 Fix typo in comment (s/patterm/pattern/).
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1726086 13f79535-47bb-0310-9956-ffa450edef68
2016-01-21 20:13:58 +00:00
0eddea67ac Added some more log numbers to log statements that
had none.

Those were not detected by the coccinelle script.
Only a few hard cases are remaining now.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1725548 13f79535-47bb-0310-9956-ffa450edef68
2016-01-19 15:43:17 +00:00
af14d158a3 Added many log numbers to log statements that
had none.

Those were not detected by the coccinelle script.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1725485 13f79535-47bb-0310-9956-ffa450edef68
2016-01-19 12:02:41 +00:00
44ce30494e Added many log numbers to log statements that
had none.

Handled all files in modules/.

I used the coccinelle script provided by Stefan.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1725392 13f79535-47bb-0310-9956-ffa450edef68
2016-01-19 00:03:18 +00:00
6c0cf71485 followup to r1657261 whitespace only -- reindent body of while loop.
(no change under svn diff -x-w)



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1657263 13f79535-47bb-0310-9956-ffa450edef68
2015-02-04 14:52:50 +00:00
78eb3b9235 *) SECURITY: CVE-2015-0228 (cve.mitre.org)
mod_lua: A maliciously crafted websockets PING after a script
     calls r:wsupgrade() can cause a child process crash.
     [Edward Lu <Chaosed0 gmail.com>]

Discovered by Guido Vranken <guidovranken gmail.com>

Submitted by: Edward Lu
Committed by: covener



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1657261 13f79535-47bb-0310-9956-ffa450edef68
2015-02-04 14:44:23 +00:00
8f40799093 Fix bit-shifting of websockets frame fields that would yield wrong opcodes
when the FIN bit was set.  Results in PING not being recognized
by mod_lua.  PR57524

Submitted By: Edward Lu
Committed By: covener



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1657256 13f79535-47bb-0310-9956-ffa450edef68
2015-02-04 14:33:51 +00:00
8216b3d0b4 mod_lua: Initial attempt at passing on the configuration tree to Lua.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1641661 13f79535-47bb-0310-9956-ffa450edef68
2014-11-25 18:04:00 +00:00
118e19314d Switch from lua_objlen() to Lua 5.2 preferred
lua_rawlen(). Define lua_rawlen() in terms of
lua_objlen() when building against older Lua.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1612552 13f79535-47bb-0310-9956-ffa450edef68
2014-07-22 11:57:06 +00:00
56d0c25725 Add missing APLOGNO.
Refactor some lines to keep APLOGNO on the same line as ap_log_error, when applicable.
Split lines longer than 80.
Improve alignment.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1612068 13f79535-47bb-0310-9956-ffa450edef68
2014-07-20 09:32:58 +00:00
2c676c90ee mod_lua: Don't quote values in cookies; Make IE happy again [#56734]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1611741 13f79535-47bb-0310-9956-ffa450edef68
2014-07-18 18:12:12 +00:00
b2605d20c4 SECURITY (CVE-2014-0226): Fix a race condition in scoreboard handling,
which could lead to a heap buffer overflow.  Thanks to Marek Kroemeke
working with HP's Zero Day Initiative for reporting this.

* include/scoreboard.h: Add ap_copy_scoreboard_worker.

* server/scoreboard.c (ap_copy_scoreboard_worker): New function.

* modules/generators/mod_status.c (status_handler): Use it.

* modules/lua/lua_request.c (lua_ap_scoreboard_worker): Likewise.

Reviewed by: trawick, jorton, covener, jim
Submitted by: jorton, covener


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1610491 13f79535-47bb-0310-9956-ffa450edef68
2014-07-14 19:26:00 +00:00
06189fe5af back to c89
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1588989 13f79535-47bb-0310-9956-ffa450edef68
2014-04-21 21:31:42 +00:00
3a7ef57c8d mod_lua: stop complaining
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1588807 13f79535-47bb-0310-9956-ffa450edef68
2014-04-20 17:56:10 +00:00
e1f073ca56 mod_lua: Use binary strstr for finding endpoints of a multipart object. (How did this EVER work?! *sigh*)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1588761 13f79535-47bb-0310-9956-ffa450edef68
2014-04-20 13:58:13 +00:00
d38e1b6e83 mod_lua: Redesign the table construction/access mechanism, so we pass on a struct with the request_rec, the table pointer and the table name instead of just the table pointer. This allows us to use the request_rec for logging/editing purposes, as well as inform the user which exact table in the request_rec was modified.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1582858 13f79535-47bb-0310-9956-ffa450edef68
2014-03-28 18:38:41 +00:00
2514105ae4 mod_lua: escape key/value pairs when setting cookies to prevent header splitting with tainted cookies.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1582253 13f79535-47bb-0310-9956-ffa450edef68
2014-03-27 10:58:35 +00:00
9dcfbbf7d4 this wasn't supposed to be a pointer, thanks Yann!
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1572748 13f79535-47bb-0310-9956-ffa450edef68
2014-02-27 21:56:59 +00:00
78f93a7569 Remove bad line that snuck into the commit
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1572704 13f79535-47bb-0310-9956-ffa450edef68
2014-02-27 19:11:54 +00:00
760d584e2b mod_lua: Only read up to whatever the user defines as max size when using r:parsebody() - if content length is greater, return an error.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1572703 13f79535-47bb-0310-9956-ffa450edef68
2014-02-27 19:10:55 +00:00
c92f2cf0ad mod_lua: Add r:wspeek for checking if data is available to be read.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1570208 13f79535-47bb-0310-9956-ffa450edef68
2014-02-20 14:46:38 +00:00
e3b43089d8 mod_lua: Slight null-check fix on setcookie.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1570156 13f79535-47bb-0310-9956-ffa450edef68
2014-02-20 11:47:47 +00:00
1d91506913 use err_headers_out for setting cookies instead of headers_out, so they persist on non-2xx/3xx statuses (Thanks to Joe Schaefer for this)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1567434 13f79535-47bb-0310-9956-ffa450edef68
2014-02-11 22:51:20 +00:00
5ed3e10473 mod_lua: Upgrade r:setcookie to accept a table of arguments, and add domain, path and HttpOnly to the list of options available for setting. PR 56128
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1567430 13f79535-47bb-0310-9956-ffa450edef68
2014-02-11 22:45:32 +00:00
92be81f133 mod_lua: Fix r:setcookie() to add, rather than replace,
the Set-Cookie header. PR56105

Submitted By: Kevin J Walters <kjw ms com>, Edward Lu <Chaosed0 gmail com>
Committed By: covener



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1567221 13f79535-47bb-0310-9956-ffa450edef68
2014-02-11 16:57:07 +00:00
40c8487150 Fix support for uploading files by using pushlstring instead of pushstring when pushing binary data.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1564727 13f79535-47bb-0310-9956-ffa450edef68
2014-02-05 12:04:14 +00:00
1ae03d3bcc mod_lua: Detect "All" or "None" before putting together a potentially blank (or static) string.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1555063 13f79535-47bb-0310-9956-ffa450edef68
2014-01-03 12:09:04 +00:00
c3e08f9469 get arpa/inet.h from apr_want.h for htons where applicable
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1551968 13f79535-47bb-0310-9956-ffa450edef68
2013-12-18 15:02:43 +00:00
dc0ff62b76 mod_lua: Fix compiler warning by using correct
APR_SIZE_T_FMT and APR_OFF_T_FMT format macro
in debug logging.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1544820 13f79535-47bb-0310-9956-ffa450edef68
2013-11-23 15:45:31 +00:00
b374da81a4 apr_file_write_full() simplification (like r1542413 and r1542416)
hopefully I sidestepped the surprising conflation of OK/APR_SUCCESS
in this code


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1542493 13f79535-47bb-0310-9956-ffa450edef68
2013-11-16 12:13:39 +00:00
5a2ba0a377 mod_lua: Use a (new) global pool/mutex setup for IVM rather than a per-process pool.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1526906 13f79535-47bb-0310-9956-ffa450edef68
2013-09-27 13:56:53 +00:00
e9ed2c0311 mod_lua: ap_ntoh64 endianess test
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1524321 13f79535-47bb-0310-9956-ffa450edef68
2013-09-18 07:48:22 +00:00
5929a20fe0 mod_lua: Figure out a way to read from SSL connections with WebSockets. Brigades ain't my strong side, so if someone could adjust it a bit, that'd be swell. It _works_, but I'm sure it could be improved upon. Also make r:wsclose() work properly with SSL.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1523432 13f79535-47bb-0310-9956-ffa450edef68
2013-09-15 12:47:50 +00:00