From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id B06E21F47D for ; Wed, 4 Jan 2023 10:34:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1672828451; bh=THhL6YQbfThUeUn/ZXYIKwLHmQBPIJEGxO/PBjhzpcw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=m3cgE3Xzcz21VUtoe6O3VbOB4hhbWL179IBjlqCuhIkr9YS7d+Sj3zJ4qM05KFMN+ cv6LUhZZDlxvW4qv6C4GujGn9PRRDcnY05OPhoIqAsVEAsvbrcPNsg13Gvpn216J3y kejFzagV5kjgep9fflcGyZhMayPL0ASeepJGanus= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 1/3] git: fix non-empty SCRIPT_NAME handling for PSGI mounts Date: Wed, 4 Jan 2023 10:34:03 +0000 Message-Id: <20230104103405.2432349-2-e@80x24.org> In-Reply-To: <20230104103405.2432349-1-e@80x24.org> References: <20230104103405.2432349-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: When using the `mount' directive in PSGI (Plack::App::URLMap), SCRIPT_NAME still needs to use a trailing slash before it can be joined with another URL. --- lib/PublicInbox/Git.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/Git.pm b/lib/PublicInbox/Git.pm index a1af776b..68f72052 100644 --- a/lib/PublicInbox/Git.pm +++ b/lib/PublicInbox/Git.pm @@ -461,10 +461,10 @@ sub local_nick ($) { sub host_prefix_url ($$) { my ($env, $url) = @_; return $url if index($url, '//') >= 0; - my $scheme = $env->{'psgi.url_scheme'}; my $host_port = $env->{HTTP_HOST} // "$env->{SERVER_NAME}:$env->{SERVER_PORT}"; - "$scheme://$host_port". ($env->{SCRIPT_NAME} || '/') . $url; + my $sn = $env->{SCRIPT_NAME} // ''; + "$env->{'psgi.url_scheme'}://$host_port$sn/$url"; } sub base_url { # for coderepos, PSGI-only