From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS11403 64.147.123.0/24 X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id D86901F463 for ; Tue, 24 Sep 2019 04:10:57 +0000 (UTC) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 9F2AD28A; Tue, 24 Sep 2019 00:10:56 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 24 Sep 2019 00:10:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=edef.eu; h=from :to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=fm1; bh=QQQQOh4uq6EX9SbwJ0C8dJA9VM Ep68qKr+S56xhlj1w=; b=sVifOoZyy/nPNDQQyV2kGxfJ9r6u+Iw+QLXZaZU1WQ bfOblo5GAULPJ6Wo+1HcfEPD47opcb+5iUpPzeGSOywPV38bUj6DmIH2JoBw7bN/ tFAybelPkQJSbsSRHYDoQSvKv6wn3fwkb6zV/HUvXaunZmhsD0mikuuuSBV3nO6Z Kvr+F+JwRsp6BvcVEGkXrpueCnHLhpFxJgQwqfQAApmSPS00xMjhoc4stzBB6RCe PJC/dgLZZQaJfWJPBPvvm11ZWiA6XM1e7ivdO9GE5BjV72wpZAxWhzVDIgsl7GR5 lhfFLcrcfx6AWklVDip5h9SD5fCFoNGMlBWF/EDU1wSQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=QQQQOh4uq6EX9SbwJ 0C8dJA9VMEp68qKr+S56xhlj1w=; b=xNZtqnDWw+6YBSiaJNa3LBsvX/Io39JIz lhCAflnBbIRc3JAcd3KzAw+kUeCC9FVxrKoQLg11FmTX7tm0nkQQKm0UQgui/zvJ a9oZQrTJ5VWAKoOwFiw3GQkkrnlVA6nGsIbNZwCiwkfO3u10oE5AGMiBxSxvQujn mQiAe121yibdRZp7NE0MxAlL0Ghn6uilbzfJGnBRJ+YSao5GYCqbCpR1AumNUozV gGQ1yT638ZJRvED868uvODDxDabnLtnrJH5J4zc+JUCV1rIKdYPUGu/5vjO5qhkW X8e7f6AsbxJ2xYH914MVc+1T6eU937pOfZPp/vbitvIgbvZfHHY9g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvdelgdekvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffoggfgsedtkeertdertd dtnecuhfhrohhmpegvuggvfhcuoegvuggvfhesvgguvghfrdgvuheqnecukfhppeduleeh rddvtddurddvtdeirddujeefnecurfgrrhgrmhepmhgrihhlfhhrohhmpegvuggvfhesvg guvghfrdgvuhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from localhost (uhura.edef.eu [195.201.206.173]) by mail.messagingengine.com (Postfix) with ESMTPA id 7284E80060; Tue, 24 Sep 2019 00:10:55 -0400 (EDT) From: edef To: meta@public-inbox.org Cc: hi@alyssa.is, edef Subject: [PATCH 0/1] Fix broken clone URLs due to SCRIPT_NAME getting reset Date: Tue, 24 Sep 2019 04:10:52 +0000 Message-Id: X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: We're trying to get public-inbox working with a PSGI file that mounts it to a subdirectory. This seems like it's intended to be a supported use case, with stuff paying attention to SCRIPT_NAME and all when generating URLs. However, Plack::App::URLMap seems determined to reset SCRIPT_NAME before getline gets called: my $orig_path_info = $env->{PATH_INFO}; my $orig_script_name = $env->{SCRIPT_NAME}; $env->{PATH_INFO} = $path; $env->{SCRIPT_NAME} = $script_name . $location; return $self->response_cb($app->($env), sub { $env->{PATH_INFO} = $orig_path_info; $env->{SCRIPT_NAME} = $orig_script_name; }); I'm not sure whether public-inbox or Plack is in the wrong here, but the timing works out poorly. By the time PublicInbox::WwwStream::_html_end gets invoked SCRIPT_NAME is blank, and the wrong URLs get generated. Copying env seems to fix it, and that's what the attached patch does. I'm pretty sure this is the wrong approach, but it seems to work. edef (1): wwwstream: copy $ctx->{env} in new lib/PublicInbox/WwwStream.pm | 4 ++++ 1 file changed, 4 insertions(+) base-commit: 55283284757af5f5d8f63fd17d53340e4dea34fb -- git-series 0.9.1