diff --git a/modules/dav/fs/repos.c b/modules/dav/fs/repos.c index 889d728a1b7..701b4425e06 100644 --- a/modules/dav/fs/repos.c +++ b/modules/dav/fs/repos.c @@ -35,6 +35,7 @@ #include "mod_dav.h" #include "repos.h" +APLOG_USE_MODULE(dav_fs); /* to assist in debugging mod_dav's GET handling */ #define DEBUG_GET_HANDLER 0 @@ -1613,6 +1614,19 @@ static dav_error * dav_fs_walker(dav_fs_walker_context *fsctx, int depth) status = apr_stat(&fsctx->info1.finfo, fsctx->path1.buf, DAV_FINFO_MASK, pool); if (status != APR_SUCCESS && status != APR_INCOMPLETE) { + dav_resource_private *ctx = params->root->info; + + ap_log_rerror(APLOG_MARK, APLOG_ERR, status, ctx->r, + APLOGNO(10472) "could not access file (%s) during directory walk", + fsctx->path1.buf); + + /* If being tolerant, ignore failure due to losing a race + * with some other process deleting files out from under + * the directory walk. */ + if ((params->walk_type & DAV_WALKTYPE_TOLERANT) + && APR_STATUS_IS_ENOENT(status)) { + continue; + } /* woah! where'd it go? */ /* ### should have a better error here */ err = dav_new_error(pool, HTTP_NOT_FOUND, 0, status, NULL); diff --git a/modules/dav/main/mod_dav.c b/modules/dav/main/mod_dav.c index 4f8d748a13a..69e068807f8 100644 --- a/modules/dav/main/mod_dav.c +++ b/modules/dav/main/mod_dav.c @@ -2269,7 +2269,7 @@ static int dav_method_propfind(request_rec *r) return HTTP_BAD_REQUEST; } - ctx.w.walk_type = DAV_WALKTYPE_NORMAL | DAV_WALKTYPE_AUTH; + ctx.w.walk_type = DAV_WALKTYPE_NORMAL | DAV_WALKTYPE_AUTH | DAV_WALKTYPE_TOLERANT; ctx.w.func = dav_propfind_walker; ctx.w.walk_ctx = &ctx; ctx.w.pool = r->pool; diff --git a/modules/dav/main/mod_dav.h b/modules/dav/main/mod_dav.h index fcf146c694c..2bfec337573 100644 --- a/modules/dav/main/mod_dav.h +++ b/modules/dav/main/mod_dav.h @@ -1834,6 +1834,7 @@ typedef struct #define DAV_WALKTYPE_AUTH 0x0001 /* limit to authorized files */ #define DAV_WALKTYPE_NORMAL 0x0002 /* walk normal files */ #define DAV_WALKTYPE_LOCKNULL 0x0004 /* walk locknull resources */ +#define DAV_WALKTYPE_TOLERANT 0x0008 /* tolerate non-fatal errors */ /* callback function and a client context for the walk */ dav_error * (*func)(dav_walk_resource *wres, int calltype); diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index 1d705f98283..b41f3ced3b1 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -4921,8 +4921,8 @@ PROXY_DECLARE(apr_status_t) ap_proxy_tunnel_create(proxy_tunnel_rec **ptunnel, apr_socket_timeout_get(tunnel->origin->pfd->desc.s, &origin_timeout); apr_socket_opt_set(tunnel->origin->pfd->desc.s, APR_SO_NONBLOCK, 1); - /* Defaults to the smallest timeout of both connections */ - tunnel->timeout = (client_timeout >= 0 && client_timeout < origin_timeout ? + /* Defaults to the largest timeout of both connections */ + tunnel->timeout = (client_timeout >= 0 && client_timeout > origin_timeout ? client_timeout : origin_timeout); /* Bidirectional non-HTTP stream will confuse mod_reqtimeoout */ diff --git a/test/modules/http2/test_712_buffering.py b/test/modules/http2/test_712_buffering.py index 9eb26890ad7..0a6978b4277 100644 --- a/test/modules/http2/test_712_buffering.py +++ b/test/modules/http2/test_712_buffering.py @@ -33,7 +33,7 @@ def test_h2_712_01(self, env): url = env.mkurl("https", "cgi", "/h2test/echo") base_chunk = "0123456789" chunks = ["chunk-{0:03d}-{1}\n".format(i, base_chunk) for i in range(5)] - stutter = timedelta(seconds=0.2) # this is short, but works on my machine (tm) + stutter = timedelta(seconds=0.2) piper = CurlPiper(env=env, url=url) piper.stutter_check(chunks, stutter) diff --git a/test/modules/http2/test_800_websockets.py b/test/modules/http2/test_800_websockets.py index 848d1f4bdb6..97e73737353 100644 --- a/test/modules/http2/test_800_websockets.py +++ b/test/modules/http2/test_800_websockets.py @@ -5,6 +5,7 @@ import subprocess import time from datetime import timedelta, datetime +from typing import Tuple, List import packaging.version import pytest @@ -23,7 +24,7 @@ def ws_run(env: H2TestEnv, path, authority=None, do_input=None, inbytes=None, send_close=True, timeout=5, scenario='ws-stdin', - wait_close: float = 0.0): + wait_close: float = 0.0) -> Tuple[ExecResult, List[str], List[WsFrame]]: """ Run the h2ws test client in various scenarios with given input and timings. :param env: the test environment @@ -95,6 +96,9 @@ def _class_scope(self, env): # with '/ws/' # The WebSocket server is started in pytest fixture 'ws_server' below. conf = H2Conf(env, extras={ + 'base': [ + 'Timeout 1', + ], f'cgi.{env.http_tld}': [ f' H2WebSockets on', f' ProxyPass /ws/ http://127.0.0.1:{env.ws_port}/ \\', @@ -338,4 +342,22 @@ def test_h2_800_17_ws_throughput(self, env: H2TestEnv, ws_server, frame_len): total_len = sum([f.data_len for f in frames if f.opcode == WsFrame.BINARY]) assert total_len == ncount * flen, f'{frames}\n{r}' # to see these logged, invoke: `pytest -o log_cli=true` - log.info(f'throughput (frame-len={frame_len}): {(total_len / (1024*1024)) / r.duration.total_seconds():0.2f} MB/s') + log.info(f'throughput (frame-len={frame_len}): "' + f'"{(total_len / (1024*1024)) / r.duration.total_seconds():0.2f} MB/s') + + # Check that the tunnel timeout is observed, e.g. the longer holds and + # the 1sec cleint conn timeout does not trigger + def test_h2_800_18_timeout(self, env: H2TestEnv, ws_server): + fname = "data-10k" + frame_delay = 1500 + flen = 10*1000 + frame_len = 8192 + # adjust frame_len to allow for 1 second overall duration + r, infos, frames = ws_run(env, path=f'/ws/file/{fname}/{frame_len}/{frame_delay}', + wait_close=2) + assert r.exit_code == 0, f'{r}' + assert infos == ['[1] :status: 200', '[1] EOF'], f'{r}' + assert len(frames) > 0 + total_len = sum([f.data_len for f in frames if f.opcode == WsFrame.BINARY]) + assert total_len == flen, f'{frames}\n{r}' + diff --git a/test/pyhttpd/curl.py b/test/pyhttpd/curl.py index 84ef9c8161a..d377a912387 100644 --- a/test/pyhttpd/curl.py +++ b/test/pyhttpd/curl.py @@ -130,9 +130,7 @@ def microsecs(tdelta): delta_mics += datetime.time(23, 59, 59, 999999) recv_deltas.append(datetime.timedelta(microseconds=delta_mics)) last_mics = mics - stutter_td = datetime.timedelta(seconds=stutter.total_seconds() * 0.9) # 10% leeway - # TODO: the first two chunks are often close together, it seems - # there still is a little buffering delay going on + stutter_td = datetime.timedelta(seconds=stutter.total_seconds() * 0.75) # 25% leeway for idx, td in enumerate(recv_deltas[1:]): assert stutter_td < td, \ f"chunk {idx} arrived too early \n{recv_deltas}\nafter {td}\n{recv_err}"