Commit Graph

4899 Commits

Author SHA1 Message Date
7ea7074ba1 ap_log_pid(): Windown does not implement apr_file_perms_set(), not a failure.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1877645 13f79535-47bb-0310-9956-ffa450edef68
2020-05-12 11:33:54 +00:00
b0b6448701 listen.c: follow up to r1876865: update APLOGNO.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1877641 13f79535-47bb-0310-9956-ffa450edef68
2020-05-12 09:52:31 +00:00
a11e54415e mpm_event: reset listener_is_wakeable on reload.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1877552 13f79535-47bb-0310-9956-ffa450edef68
2020-05-10 15:24:10 +00:00
ce3b16e988 util_md5: avoid temporary stack result in ap_md5_binary().
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1877551 13f79535-47bb-0310-9956-ffa450edef68
2020-05-10 15:23:08 +00:00
34745a1892 util_expr: allow to specify only one of ap_expr_eval_ctx_t's r/c/s.
Depending on where the expression is evaluated, a request_rec might not be
available, so allow to specify only a conn_rec or a server_rec (at least) in
the passed in ap_expr_eval_ctx_t.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1877550 13f79535-47bb-0310-9956-ffa450edef68
2020-05-10 15:15:21 +00:00
3c6b925a2a util_filter: export ap_filter_adopt_brigade() since mod_ssl uses it.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1877548 13f79535-47bb-0310-9956-ffa450edef68
2020-05-10 12:34:53 +00:00
e9945c13ee ap_core_input_filter(): axe unnecessary AP_MODE_SPECULATIVE test.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1877455 13f79535-47bb-0310-9956-ffa450edef68
2020-05-06 19:52:47 +00:00
58c4c85ff7 Constify pointers in ap_expr lookup tables, as well as the already
const pointed-to strings.  ~1/2Kb moves to r/o text section, size(1)
diff:

    text           data     bss     dec     hex filename
- 667519          18384   13952  699855   aadcf httpd
+ 668015          17864   13952  699831   aadb7 httpd

* server/util_expr_eval.c
  [*_var_names, expr_provider_multi]: Mark pointers in name
  lists as const.
  (core_expr_lookup): Adjust accordingly.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1877350 13f79535-47bb-0310-9956-ffa450edef68
2020-05-04 10:48:55 +00:00
9f31d7b1f3 util_filter: axe misleading AP_BUCKET_IS_MORPHING() macro and fix comments.
Morphing buckets are not only those with ->length == -1, so the macro is
misleading. Modify comments to talk about opaque buckets when length == -1
and about morphing buckets (once) for opaque and FILE buckets.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1877077 13f79535-47bb-0310-9956-ffa450edef68
2020-04-27 14:22:04 +00:00
a42f3692b1 Add optional options= argument to Listen to add listener-specific
socket options.

Reimplement "use_specific_errors" listener flag under generic
ap_listen_rec flags field holding all listener-specific options.

* include/ap_listen.h: Add AP_LISTEN_* flags.
  (ap_listen_rec): Rename use_specific_errors to flags.

* server/listen.c (make_sock): Set APR_SO_FREEBIND if
  AP_LISTEN_FREEBIND flag is set on listener; set APR_SO_REUSEPORT
  unconditionally if AP_LISTEN_REUSEPORT is set.
  (alloc_listener): Take flags argument.
  (ap_setup_listeners): Set AP_LISTEN_SPECIFIC_ERRORS flag here.
  (ap_set_listener): Parse optional options=... argument, catch
  typos and fail if protocol name contains a "=".
  (ap_duplicate_listeners): Duplicate flags.

Submitted by: jkaluza, Lubos Uhliarik <luhliari redhat.com>, jorton
PR: 61865
Github: closes #114


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1876865 13f79535-47bb-0310-9956-ffa450edef68
2020-04-23 08:26:26 +00:00
48aa76e1fc config: allow for environment variable substitution fallback to default value.
Make ap_resolve_env() handle the ${VAR?=default value} syntax, and update docs.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1876835 13f79535-47bb-0310-9956-ffa450edef68
2020-04-22 16:30:58 +00:00
ac762c1ae1 core: follow up to r1876664: allow ErrorDocument to read body when applicable
Unless ap_read_request() failed to read the request line or header, or
Transfer-Encoding is invalid, we can still provide the request body to custom
error handlers (ErrorDocument) that ask it (e.g. internal redirects to CGI).

So this commit splits early failure path (previously die_early label) in two,
die_unusable_input and die_before_hooks, where the latter preserves input
filters (including HTTP_IN).

Also, the code to apply the connection timeout and r->per_dir_config from the
server is now in a new apply_server_config() helper since it's used multiple
times. Note that apr_socket_timeout_set() is a noop if the new timeout is the
same as the one already in place, so there is no need to cache the old timeout
nor use apr_socket_timeout_get(). Likewise, r->server is initially set to
c->base_server so apply_server_config() is overall a noop when no change is
needed.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1876784 13f79535-47bb-0310-9956-ffa450edef68
2020-04-21 10:29:07 +00:00
22b3d7cec4 core, h2: common ap_parse_request_line() and ap_check_request_header() code.
Extract parsing/validation code from read_request_line() and ap_read_request()
into ap_parse_request_line() and ap_check_request_header() helpers such that
mod_http2 can validate its HTTP/1 request with the same/configured policy.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1876674 13f79535-47bb-0310-9956-ffa450edef68
2020-04-17 16:47:42 +00:00
b157ae396c core, h2: send EOR for early HTTP request failure.
The core output filters depend on EOR being sent at some point for correct
accounting of setaside limits and lifetime.

Rework ap_read_request() early failure (including in post_read_request() hooks)
so that it always sends the EOR after ap_die().

Apply the same scheme in h2_request_create_rec() which is the HTTP/2 to HTTP/1
counterpart.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1876664 13f79535-47bb-0310-9956-ffa450edef68
2020-04-17 13:07:46 +00:00
504c211981 * server/mpm/prefork/prefork.c (prefork_pre_config): Use pconf as
passed to the hook with ap_fatal_signal_child_setup, since
  prefork.c's pconf "global" is not set until the (later) open_logs
  hook, and if built as a DSO it may be reset inbetween.

* server/mpm/motorz/motorz.c (motorz_pre_config): Likewise.

[event and worker do not appear to have the same issue]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1876626 13f79535-47bb-0310-9956-ffa450edef68
2020-04-16 18:22:43 +00:00
f461bcf12c Add missing pool tags to help debugging.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1876599 13f79535-47bb-0310-9956-ffa450edef68
2020-04-16 12:32:33 +00:00
bb65d8c780 Issue a warning for non-existent directories when running configtest
Submitted By: Stéphane Blondon <stephane.blondon gmail.com>
Committed By: covener



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1876402 13f79535-47bb-0310-9956-ffa450edef68
2020-04-11 18:47:46 +00:00
343cdd9bb4 core: add r->flushed flag and set it when the response is sent.
By setting EOR->r->flushed in the core output filter, allow one to determine at
log_transaction hook time whether the request has been fully flushed through
the network, or not (network issue, filter error, n-th pipelined resposne...).

Introduce the ap_bucket_eor_request() helper to get the request bound to an EOR
bucket, and uses it in ap_core_output_filter() to mark the EOR's request just
before destroying it, after all the previous buckets have been sent.

While at it, rename the request_rec* member of struct ap_bucket_eor from "data"
to "r", which makes the code clearer (not to be confused with b->data).

Finally, add CustomLog format %F, showing "F" or "-" depending on r->flushed,
for admins to figure out for each request.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1876017 13f79535-47bb-0310-9956-ffa450edef68
2020-04-01 22:56:44 +00:00
36c3f0fcd1 ap_core_output_filter: follow up to r1875947: don't swallow bucket read EOF.
Morphing buckets don't return APR_EOF on read when exhausted, ignoring EOF
here could mask real errors (e.g. FILE bucket truncated under us).

Thanks rpluem/jorton!


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1876000 13f79535-47bb-0310-9956-ffa450edef68
2020-04-01 12:53:36 +00:00
b3110d36af core: handle morphing buckets setaside/reinstate and kill request core filter.
The purpose of ap_request_core_filter() is not clear, it seems to prevent
potential morphing buckets to go through AP_FTYPE_CONNECTION filters which
would fail to set them aside (ENOTIMPL), and read them (unbounded) in memory.

This patch allows ap_filter_setaside_brigade() to set morphing buckets aside
by simply moving them, assuming they have the correct lifetime (either until
some further EOR, or the connection lifetime, or whatever). IOW, the module is
responsible for sending morphing buckets whose lifetime needs not be changed
by the connection filters.

Now since morphing buckets consume no memory until (apr_bucket_)read, like FILE
buckets, we don't account for them in flush_max_threshold either. This changes
ap_filter_reinstate_brigade() to only account for in-memory and EOR buckets to
flush_upto.

Also, since the EOR bucket is sent only to c->output_filters once the request
is processed, when all the filters < AP_FTYPE_CONNECTION have done their job
and stopped retaining data (after the EOS bucket, if ever), we prevent misuse
of ap_filter_{setaside,reinstate}_brigade() outside connection filters by
returning ENOTIMPL. This is not the right API for request filters as of now.

Finally, ap_request_core_filter() and co can be removed.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1875947 13f79535-47bb-0310-9956-ffa450edef68
2020-03-31 16:22:53 +00:00
8e7b3d4902 revert for now, surprising the scheme is present.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1875605 13f79535-47bb-0310-9956-ffa450edef68
2020-03-25 02:01:04 +00:00
1acda06095 PR63437: don't clobber the scheme in r->uri with MergeSlashes
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1875604 13f79535-47bb-0310-9956-ffa450edef68
2020-03-25 01:52:48 +00:00
845110441e * server/log.c (ap_log_pid): Use more traditional C style in httpd for
exception-handling.  No functional change.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1875240 13f79535-47bb-0310-9956-ffa450edef68
2020-03-16 12:19:59 +00:00
dd10a9352e * server/log.c (ap_log_pid): Use a temporary file, then rename once
successfully written; also add error checking.  Avoids startup
  failures if a previous httpd invocation crashed while writing the
  pidfile.

Submitted by: Nicolas Carrier <carrier.nicolas0 gmail.com>, jorton
Github: closes #100, closes #69
PR: 63140


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1875153 13f79535-47bb-0310-9956-ffa450edef68
2020-03-13 14:34:18 +00:00
b25a60177a malloc -> ap_malloc
bz #63967


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1874470 13f79535-47bb-0310-9956-ffa450edef68
2020-02-24 21:19:47 +00:00
635f8ba38e mpm_event: avoid possible KeepAlveTimeout off by -100 ms.
Use TIMEOUT_FUDGE_FACTOR to limit wakeups from queues_next_expiry, yet consider
the current/unfudged timestamp to process/cleanup the queues (once woken up).


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1874277 13f79535-47bb-0310-9956-ffa450edef68
2020-02-20 23:41:21 +00:00
f71e6fc9a3 convert malloc(3) into ap_malloc
bz 64049


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1874156 13f79535-47bb-0310-9956-ffa450edef68
2020-02-18 07:37:45 +00:00
c8f486d716 Follow up to r1873941: define AP_REG_NO_DEFAULT for raw ap_regcomp() usage.
This avoids having to define AP_REG_NO_* for each APR_REG_* specific option,
thus replacing AP_REG_NO_DOTALL introduced lately.

For ap_rxplus_compile() and mod_substitute where default AP_REG_DOTALL is not
suitable, let's use:
    AP_REG_NO_DEFAULT | ap_regcomp_get_default_cflags() & AP_REG_DOLLAR_ENDONLY
to keep the default AP_REG_DOLLAR_ENDONLY unless RegexDefaultOptions unsets it.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1874090 13f79535-47bb-0310-9956-ffa450edef68
2020-02-16 23:08:32 +00:00
e957c6ddc9 Follow up to r1874055: fix typo.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1874062 13f79535-47bb-0310-9956-ffa450edef68
2020-02-15 19:13:09 +00:00
b1a82c2ce3 Avoid UBSan exception calling memcpy(,NULL,0) at startup.
Follow-up to r1874011 which did the same for the event MPM.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1874055 13f79535-47bb-0310-9956-ffa450edef68
2020-02-15 14:22:22 +00:00
e553264168 * server/mpm/event/event.c (event_open_logs): Avoid UBSan exception
calling memcpy(,NULL,0) at startup.  Thanks to rpluem.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1874011 13f79535-47bb-0310-9956-ffa450edef68
2020-02-14 10:47:36 +00:00
85760859ca Fix spelling errors found by codespell. [skip ci]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1873985 13f79535-47bb-0310-9956-ffa450edef68
2020-02-13 18:15:57 +00:00
b6dd2f55dc don't use DOTALL from mod_substitute which leaves \n at the end of the line.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1873941 13f79535-47bb-0310-9956-ffa450edef68
2020-02-12 13:36:40 +00:00
c1ac12fa3b factor out TE=chunked checking
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1873748 13f79535-47bb-0310-9956-ffa450edef68
2020-02-07 17:14:05 +00:00
81313af01a factor out default regex flags
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1873747 13f79535-47bb-0310-9956-ffa450edef68
2020-02-07 17:08:41 +00:00
3ddb50dbb5 PR63669: handle APR_BADARG return from ap_rgetline
Submitted By: Giovanni Bechis <giovanni paclan.it>



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1873394 13f79535-47bb-0310-9956-ffa450edef68
2020-01-31 02:15:57 +00:00
7b406d6d74 config: Speed up graceful restarts by using pre-hashed command table. PR 64066.
[Giovanni Bechis <giovanni paclan.it>, Jim Jagielski]


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1872786 13f79535-47bb-0310-9956-ffa450edef68
2020-01-14 17:31:49 +00:00
556fdf0dd3 In winnt_accept() (server/mpm/winnt/child.c), there's a call to PostQueuedCompletionStatus() with a buffer (BytesRead) for the number of bytes read.
When compiling the code with Visual Studio 2019 (v 16.3.10), we get a warning than BytesRead is not initialized. When using /RTCu (run-time checks for uninitialzed variables), the program crashes on this line with an exception.

If we initialize the variable to 0, the problem is solved.

PR 63965

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1872394 13f79535-47bb-0310-9956-ffa450edef68
2020-01-06 21:29:42 +00:00
bcfd0565d4 * server/util_expr_parse.[ch]: Regenerate after r1869724.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1869725 13f79535-47bb-0310-9956-ffa450edef68
2019-11-13 08:02:43 +00:00
11ec7b0061 Non terminal cannot have string aliases (only tokens appear in error
messages).  %token is used to define tokens, and %nterm non terminals.
The hidden %type (which was only recently documented) is meant for
both tokens and non terminals.  Yet

    %type <foo> expr "expression"

is actually more or less equivalent to

    %nterm <foo> expr
    %token <foo> "expression"

which is clearly not the intention of the author here.

* server/util_expr_parse.y: Remove useless string-literal only tokens.
Prefer %nterm to %type to avoid this error.

PR: #72
Submitted by: Akim Demaille <akim.demaille gmail.com>


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1869724 13f79535-47bb-0310-9956-ffa450edef68
2019-11-13 08:01:13 +00:00
cdc97c4368 Revert r1869222, wrong files committed.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1869223 13f79535-47bb-0310-9956-ffa450edef68
2019-10-31 16:10:08 +00:00
e2d7af8692 mod_proxy_http: follow up to r1869216.
Let's call stream_reqbody() for all rb_methods, no RB_SPOOL_CL special case.

This both simplifies code and allows to keep EOS into the input_brigade until
it's sent, and thus detect whether we already fetched the whole body if/when
proxy_http_handler() re-enters for different balancer members.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1869222 13f79535-47bb-0310-9956-ffa450edef68
2019-10-31 16:08:33 +00:00
b936beed5c mod_proxy_http: Fix 100-continue deadlock for spooled request bodies. PR 63855.
Send "100 Continue", if needed, before fetching/blocking on the request body in
spool_reqbody_cl(), otherwise mod_proxy and the client can wait for each other,
leading to a request timeout (408).

While at it, make so that ap_send_interim_response() uses the default status
line if none is set in r->status_line.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1868576 13f79535-47bb-0310-9956-ffa450edef68
2019-10-18 07:50:59 +00:00
12558f2ec1 Fix a typo in a message.
Reported and fixed by Christian Bartolomäus (bartolin gmx.de)
PR 63806

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1868016 13f79535-47bb-0310-9956-ffa450edef68
2019-10-05 13:42:00 +00:00
4fa8d6d8a4 Merge r1866760 from ^/httpd/apreq/trunk:
parser_multipart: fix NULL pointer dereference in nested multipart

create_multipart_context() can return NULL if the given Content-Type
was not recognized (if there is no "boundary" attribute).  This
crashes libapreq2.

This bug was introduced by SVN commit 227276.  Prior to this commit,
there was a NULL check, but the commit removed it:

 http://svn.apache.org/viewvc/httpd/apreq/trunk/library/parser_multipart.c?r1=227276&r2=227275&pathrev=227276

Submitted by: max 


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1867761 13f79535-47bb-0310-9956-ffa450edef68
2019-09-30 09:50:44 +00:00
e1f29d826e Fix an issue on Windows where <IfFile> looks for a file on a non-existent drive (on a USB key that is not plugged for example)
Issue repported by Heather Lotz <knot22 hotmail.com>

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1866418 13f79535-47bb-0310-9956-ffa450edef68
2019-09-04 19:11:28 +00:00
48d5813674 Fix a signed/unsigned comparison that can never match.
-1 is a valid length value (for socket, pipe and cgi buckets for example)
All path I've checked cast the -1 to (apr_size_t) in order for the comparison to work. So do it as well here.

This has been like that in trunk since r708144, about 11 years ago, so I assume that it is not really an issue.

Spotted by gcc 9.1 and -Wextra

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1864868 13f79535-47bb-0310-9956-ffa450edef68
2019-08-10 09:52:34 +00:00
052e0151ca Fix a signed/unsigned comparison that can never match.
(+ add a missing space to improve formating)

Spotted by gcc 9.1 and -Wextra

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1864865 13f79535-47bb-0310-9956-ffa450edef68
2019-08-10 08:59:13 +00:00
905b4af030 set PCRE_DOTALL by default
Submitted by ylavic



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1864192 13f79535-47bb-0310-9956-ffa450edef68
2019-08-02 01:31:28 +00:00
cc1c3009c5 Synch 2.4 and trunk.
Remove an empty line that must have been missed in a backport.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1863448 13f79535-47bb-0310-9956-ffa450edef68
2019-07-20 08:06:04 +00:00