On Mon, Aug 12, 2024 at 5:18 AM Ruediger Pluem <rpl...@apache.org> wrote: > > > > On 8/7/24 2:37 PM, Ruediger Pluem wrote: > > > > > > On 7/30/24 9:52 AM, SteffenAL wrote: > >> > >> Please have a look > >> > >> https://www.apachelounge.com/viewtopic.php?p=42911 > > > > Can we have the full LogLevel trace8 error_log posted here or in the forum > > (the link above only contains a snipped). > > Meanwhile I got the logs off-list. Thanks. Can you please add the UNC flag > (https://httpd.apache.org/docs/2.4/rewrite/flags.html#flag_unc) to each of > your .htaccess / per directory rewriterules? > > To my fellow developers: > > I think the slash merging block in case of a per-dir rewrite is wrong: > > if (!(p->flags & RULEFLAG_UNC)) { > /* merge leading slashes, unless they were literals in the sub */ > if (!AP_IS_SLASH(p->output[0]) || !AP_IS_SLASH(p->output[1])) { > while (AP_IS_SLASH(r->filename[0]) && > AP_IS_SLASH(r->filename[1])) { > r->filename++; > } > } > } > > The dir prefix which is already added at this point of time can start with > '//' while the output of the rule does not as it is > relative to the directory. I think in the per-dir context this check is not > needed and should be removed.
Good find. It seems like the substitution itself could still be tricked into // in perdir context though, and then no prefix is added. So I guess we should track directly whether any prefix was added as in https://people.apache.org/~covener/patches/rewrite-unc-perdir.diff ?