unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 4/6] www: use PSGI env directly
Date: Sat,  2 Jul 2016 07:56:36 +0000	[thread overview]
Message-ID: <20160702075638.31017-5-e@80x24.org> (raw)
In-Reply-To: <20160702075638.31017-1-e@80x24.org>

More work on on the Plack::Request/CGI.pm removal front,
No need to access the PSGI env through an extra hash lookup.
---
 lib/PublicInbox/SearchView.pm | 2 +-
 lib/PublicInbox/WWW.pm        | 9 ++++-----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm
index ce1eff1..15bb823 100644
--- a/lib/PublicInbox/SearchView.pm
+++ b/lib/PublicInbox/SearchView.pm
@@ -86,7 +86,7 @@ sub mset_summary {
 sub err_txt {
 	my ($ctx, $err) = @_;
 	my $u = '//xapian.org/docs/queryparser.html';
-	$u = PublicInbox::Hval::prurl($ctx->{cgi}->{env}, $u);
+	$u = PublicInbox::Hval::prurl($ctx->{env}, $u);
 	$err =~ s/^\s*Exception:\s*//; # bad word to show users :P
 	$err = ascii_html($err);
 	"\nBad query: <b>$err</b>\n" .
diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm
index 1e23c43..940e1c5 100644
--- a/lib/PublicInbox/WWW.pm
+++ b/lib/PublicInbox/WWW.pm
@@ -152,7 +152,7 @@ sub invalid_inbox {
 		$ctx->{git_dir} = $obj->{mainrepo};
 		$ctx->{git} = $obj->git;
 		# for PublicInbox::HTTP::weaken_task:
-		$ctx->{cgi}->{env}->{'pi-httpd.inbox'} = $obj;
+		$ctx->{env}->{'pi-httpd.inbox'} = $obj;
 		$ctx->{-inbox} = $obj;
 		$ctx->{inbox} = $inbox;
 		return;
@@ -162,7 +162,7 @@ sub invalid_inbox {
 	# generation and link things intended for nntp:// to https?://,
 	# so try to infer links and redirect them to the appropriate
 	# list URL.
-	$self->news_www->call($ctx->{cgi}->{env});
+	$self->news_www->call($ctx->{env});
 }
 
 # returns undef if valid, array ref response if invalid
@@ -284,7 +284,7 @@ sub footer {
 	$ctx->{footer} = join("\n",
 		'- ' . $desc,
 		"A <a\nhref=\"" .
-			PublicInbox::Hval::prurl($ctx->{cgi}->{env}, PI_URL) .
+			PublicInbox::Hval::prurl($ctx->{env}, PI_URL) .
 			'">public-inbox</a>, ' .
 			'anybody may post in plain-text (not HTML):',
 		$addr,
@@ -388,13 +388,12 @@ sub legacy_redirects {
 	} elsif ($path_info =~ m!$INBOX_RE/(\S+/\S+)/f\z!o) {
 		r301($ctx, $1, $2);
 	} else {
-		$self->news_www->call($ctx->{cgi}->{env});
+		$self->news_www->call($ctx->{env});
 	}
 }
 
 sub r301 {
 	my ($ctx, $inbox, $mid, $suffix) = @_;
-	my $cgi = $ctx->{cgi};
 	my $obj = $ctx->{-inbox};
 	unless ($obj) {
 		my $r404 = invalid_inbox($ctx->{www}, $ctx, $inbox);
-- 
EW


  parent reply	other threads:[~2016-07-02  7:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-02  7:56 [PATCH 0/6] misc cleanups Eric Wong
2016-07-02  7:56 ` [PATCH 1/6] TODO: clarify streaming Email::MIME replacement Eric Wong
2016-07-02  7:56 ` [PATCH 2/6] inbox: base_url method takes PSGI env hashref instead Eric Wong
2016-07-02  7:56 ` [PATCH 3/6] extmsg: rework to use Inbox objects Eric Wong
2016-07-02  7:56 ` Eric Wong [this message]
2016-07-02  7:56 ` [PATCH 5/6] view: rely on internal query parser for 'o' param Eric Wong
2016-07-02  7:56 ` [PATCH 6/6] www: remove Plack::Request dependency entirely Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160702075638.31017-5-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).