Skip to content

Commit

Permalink
Merge branch 'apache:trunk' into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
samkenxstream authored Jul 6, 2023
2 parents 5de7c50 + 88db699 commit e5f76b5
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 9 deletions.
14 changes: 14 additions & 0 deletions modules/dav/fs/repos.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion modules/dav/main/mod_dav.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions modules/dav/main/mod_dav.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions modules/proxy/proxy_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion test/modules/http2/test_712_buffering.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
26 changes: 24 additions & 2 deletions test/modules/http2/test_800_websockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import subprocess
import time
from datetime import timedelta, datetime
from typing import Tuple, List
import packaging.version

import pytest
Expand All @@ -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
Expand Down Expand Up @@ -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}/ \\',
Expand Down Expand Up @@ -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}'

4 changes: 1 addition & 3 deletions test/pyhttpd/curl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"

0 comments on commit e5f76b5

Please sign in to comment.