user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 3/5] githttpbackend: remove ancient compatibility check
  @ 2019-12-31 10:30  6% ` Eric Wong
  0 siblings, 0 replies; 3+ results
From: Eric Wong @ 2019-12-31 10:30 UTC (permalink / raw)
  To: meta

The ref() call could be hitting memory leaks on Perl 5.16.x.

It's been 3 years (2016-12-25) since 292ca34140489da2
("githttpbackend: simplify compatibility code") back when
this project was barely known and probably nobody used
examples/public-inbox.psgi...
---
 lib/PublicInbox/GitHTTPBackend.pm | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/lib/PublicInbox/GitHTTPBackend.pm b/lib/PublicInbox/GitHTTPBackend.pm
index 8dd27a75..8883ec34 100644
--- a/lib/PublicInbox/GitHTTPBackend.pm
+++ b/lib/PublicInbox/GitHTTPBackend.pm
@@ -47,9 +47,6 @@ sub r ($;$) {
 sub serve {
 	my ($env, $git, $path) = @_;
 
-	# XXX compatibility... ugh, can we stop supporting this?
-	$git = PublicInbox::Git->new($git) unless ref($git);
-
 	# Documentation/technical/http-protocol.txt in git.git
 	# requires one and exactly one query parameter:
 	if ($env->{QUERY_STRING} =~ /\Aservice=git-[A-Za-z0-9_]+-pack\z/ ||

^ permalink raw reply related	[relevance 6%]

* [PATCH 2/4] githttpbackend: simplify compatibility code
  2016-12-25 10:36  6% [PATCH 0/4] various cleanups around http Eric Wong
@ 2016-12-25 10:36  7% ` Eric Wong
  0 siblings, 0 replies; 3+ results
From: Eric Wong @ 2016-12-25 10:36 UTC (permalink / raw)
  To: meta

Fewer conditionals means theres fewer code paths to test
and makes things easier-to-read.
---
 examples/public-inbox.psgi        |  1 +
 lib/PublicInbox/GitHTTPBackend.pm | 15 ++++++---------
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/examples/public-inbox.psgi b/examples/public-inbox.psgi
index e97f917..98cde92 100644
--- a/examples/public-inbox.psgi
+++ b/examples/public-inbox.psgi
@@ -14,6 +14,7 @@ my $www = PublicInbox::WWW->new;
 
 # share the public-inbox code itself:
 my $src = $ENV{SRC_GIT_DIR}; # '/path/to/public-inbox.git'
+$src = PublicInbox::Git->new($src) if defined $src;
 
 builder {
 	eval {
diff --git a/lib/PublicInbox/GitHTTPBackend.pm b/lib/PublicInbox/GitHTTPBackend.pm
index 86b8ebc..4ad3fd1 100644
--- a/lib/PublicInbox/GitHTTPBackend.pm
+++ b/lib/PublicInbox/GitHTTPBackend.pm
@@ -46,6 +46,9 @@ sub r ($;$) {
 sub serve {
 	my ($env, $git, $path) = @_;
 
+	# XXX compatibility... ugh, can we stop supporting this?
+	$git = PublicInbox::Git->new($git) unless ref($git);
+
 	# Documentation/technical/http-protocol.txt in git.git
 	# requires one and exactly one query parameter:
 	if ($env->{QUERY_STRING} =~ /\Aservice=git-\w+-pack\z/ ||
@@ -98,7 +101,7 @@ sub serve_dumb {
 		return r(404);
 	}
 
-	my $f = (ref $git ? $git->{git_dir} : $git) . '/' . $path;
+	my $f = $git->{git_dir} . '/' . $path;
 	return r(404) unless -f $f && -r _; # just in case it's a FIFO :P
 	my $size = -s _;
 
@@ -196,14 +199,8 @@ sub serve_smart {
 		my $val = $env->{$name};
 		$env{$name} = $val if defined $val;
 	}
-	my ($git_dir, $limiter);
-	if (ref $git) {
-		$limiter = $git->{-httpbackend_limiter} || $default_limiter;
-		$git_dir = $git->{git_dir};
-	} else {
-		$limiter = $default_limiter;
-		$git_dir = $git;
-	}
+	my $limiter = $git->{-httpbackend_limiter} || $default_limiter;
+	my $git_dir = $git->{git_dir};
 	$env{GIT_HTTP_EXPORT_ALL} = '1';
 	$env{PATH_TRANSLATED} = "$git_dir/$path";
 	my $rdr = { 0 => fileno($in) };
-- 
EW


^ permalink raw reply related	[relevance 7%]

* [PATCH 0/4] various cleanups around http
@ 2016-12-25 10:36  6% Eric Wong
  2016-12-25 10:36  7% ` [PATCH 2/4] githttpbackend: simplify compatibility code Eric Wong
  0 siblings, 1 reply; 3+ results
From: Eric Wong @ 2016-12-25 10:36 UTC (permalink / raw)
  To: meta

Eric Wong (4):
      githttpbackend: minor readability improvement
      githttpbackend: simplify compatibility code
      githttpbackend: minor cleanups to improve readability
      httpd/async: improve variable naming

 examples/public-inbox.psgi        |  1 +
 lib/PublicInbox/GitHTTPBackend.pm | 41 +++++++++++++++++----------------------
 lib/PublicInbox/HTTPD/Async.pm    | 14 ++++++-------
 3 files changed, 26 insertions(+), 30 deletions(-)

^ permalink raw reply	[relevance 6%]

Results 1-3 of 3 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-12-25 10:36  6% [PATCH 0/4] various cleanups around http Eric Wong
2016-12-25 10:36  7% ` [PATCH 2/4] githttpbackend: simplify compatibility code Eric Wong
2019-12-31 10:30     [PATCH 0/5] some minor cleanups and doc updates Eric Wong
2019-12-31 10:30  6% ` [PATCH 3/5] githttpbackend: remove ancient compatibility check 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).