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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
-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