From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.8 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, URIBL_BLOCKED shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: meta@public-inbox.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 382BA20208 for ; Mon, 4 Jan 2016 01:03:56 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/4] www: comments for denoting Plack::Request vs CGI Date: Mon, 4 Jan 2016 01:03:50 +0000 Message-Id: <20160104010352.26568-3-e@80x24.org> In-Reply-To: <20160104010352.26568-1-e@80x24.org> References: <20160104010352.26568-1-e@80x24.org> List-Id: We'll probably want to continue supporting CGI for mod_perl compatibility. --- lib/PublicInbox/ExtMsg.pm | 2 +- lib/PublicInbox/Feed.pm | 2 +- lib/PublicInbox/WWW.pm | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/ExtMsg.pm b/lib/PublicInbox/ExtMsg.pm index 59bbae5..a56df33 100644 --- a/lib/PublicInbox/ExtMsg.pm +++ b/lib/PublicInbox/ExtMsg.pm @@ -89,7 +89,7 @@ sub ext_msg { again: my $cgi = $ctx->{cgi}; my $url = ref($cgi) eq 'CGI' ? $cgi->url(-base) . '/' - : $cgi->base->as_string; + : $cgi->base->as_string; # Plack::Request $url .= $listname; unshift @pfx, { git_dir => $ctx->{git_dir}, url => $url }; foreach my $pfx (@pfx) { diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index 5708b60..65514eb 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -287,7 +287,7 @@ sub get_feedopts { my $base; if (ref($cgi) eq 'CGI') { $base = $cgi->url(-base); - } else { + } else { # Plack::Request $base = $cgi->base->as_string; $base =~ s!/\z!!; } diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm index b4c050b..411db16 100644 --- a/lib/PublicInbox/WWW.pm +++ b/lib/PublicInbox/WWW.pm @@ -198,6 +198,7 @@ sub get_thread { sub self_url { my ($cgi) = @_; + # Plack::Request ref($cgi) eq 'CGI' ? $cgi->self_url : $cgi->uri->as_string; } @@ -362,7 +363,7 @@ sub r301 { if (ref($cgi) eq 'CGI') { $url = $cgi->url(-base) . '/'; $qs = $cgi->query_string; - } else { + } else { # Plack::Request $url = $cgi->base->as_string; $qs = $cgi->env->{QUERY_STRING}; } -- EW