user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH 0/1] Fix broken clone URLs due to SCRIPT_NAME getting reset
@ 2019-09-24  4:10 edef
  2019-09-24  4:10 ` [PATCH 1/1] wwwstream: copy $ctx->{env} in new edef
  2019-09-26  3:03 ` [PATCH 0/1] Fix broken clone URLs due to SCRIPT_NAME getting reset Eric Wong
  0 siblings, 2 replies; 4+ messages in thread
From: edef @ 2019-09-24  4:10 UTC (permalink / raw)
  To: meta; +Cc: hi, edef

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-01  7:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-24  4:10 [PATCH 0/1] Fix broken clone URLs due to SCRIPT_NAME getting reset edef
2019-09-24  4:10 ` [PATCH 1/1] wwwstream: copy $ctx->{env} in new edef
2019-09-26  3:03 ` [PATCH 0/1] Fix broken clone URLs due to SCRIPT_NAME getting reset Eric Wong
2019-10-01  7:13   ` [PATCH] www: fix absolute URLs when mounted under a subdir Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).