user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH 0/2] HTTPS smart git repository for our code
@ 2016-07-01  1:17 Eric Wong
  2016-07-01  1:17 ` [PATCH 1/2] githttpbackend: allow git to be a regular scalar string Eric Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Eric Wong @ 2016-07-01  1:17 UTC (permalink / raw)
  To: meta

Eating our own dogfood, git://80x24.org/public-inbox remains
available for those without curl or up-to-date TLS stack/certs.

Eric Wong (2):
      githttpbackend: allow git to be a regular scalar string
      update git repo location to https:// using GitHTTPBackend.pm

 Documentation/dc-dlvr-spam-flow.txt |  2 +-
 README                              |  2 +-
 examples/public-inbox.psgi          | 14 +++++++++++++-
 examples/unsubscribe.psgi           |  3 ++-
 lib/PublicInbox/GitHTTPBackend.pm   |  4 ++--
 lib/PublicInbox/Unsubscribe.pm      |  2 +-
 lib/PublicInbox/WwwStream.pm        |  6 +++---
 7 files changed, 23 insertions(+), 10 deletions(-)


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

* [PATCH 1/2] githttpbackend: allow git to be a regular scalar string
  2016-07-01  1:17 [PATCH 0/2] HTTPS smart git repository for our code Eric Wong
@ 2016-07-01  1:17 ` Eric Wong
  2016-07-01  1:17 ` [PATCH 2/2] update git repo location to https:// using GitHTTPBackend.pm Eric Wong
  2016-07-01  2:15 ` [PATCH 3/2] git: allow cloning from the URL root, too Eric Wong
  2 siblings, 0 replies; 5+ messages in thread
From: Eric Wong @ 2016-07-01  1:17 UTC (permalink / raw)
  To: meta

No point in forcing users to pass a hashref/object to
get a single git directory.
---
 lib/PublicInbox/GitHTTPBackend.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/PublicInbox/GitHTTPBackend.pm b/lib/PublicInbox/GitHTTPBackend.pm
index 7267a1d..4f58c6b 100644
--- a/lib/PublicInbox/GitHTTPBackend.pm
+++ b/lib/PublicInbox/GitHTTPBackend.pm
@@ -80,7 +80,7 @@ sub serve_dumb {
 		return r(404);
 	}
 
-	my $f = "$git->{git_dir}/$path";
+	my $f = (ref $git ? $git->{git_dir} : $git) . '/' . $path;
 	return r(404) unless -f $f && -r _; # just in case it's a FIFO :P
 	my @st = stat(_);
 	my $size = $st[7];
@@ -179,7 +179,7 @@ sub serve_smart {
 		my $val = $env->{$name};
 		$env{$name} = $val if defined $val;
 	}
-	my $git_dir = $git->{git_dir};
+	my $git_dir = ref $git ? $git->{git_dir} : $git;
 	$env{GIT_HTTP_EXPORT_ALL} = '1';
 	$env{PATH_TRANSLATED} = "$git_dir/$path";
 	my %rdr = ( 0 => fileno($in) );

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

* [PATCH 2/2] update git repo location to https:// using GitHTTPBackend.pm
  2016-07-01  1:17 [PATCH 0/2] HTTPS smart git repository for our code Eric Wong
  2016-07-01  1:17 ` [PATCH 1/2] githttpbackend: allow git to be a regular scalar string Eric Wong
@ 2016-07-01  1:17 ` Eric Wong
  2016-07-01  2:15 ` [PATCH 3/2] git: allow cloning from the URL root, too Eric Wong
  2 siblings, 0 replies; 5+ messages in thread
From: Eric Wong @ 2016-07-01  1:17 UTC (permalink / raw)
  To: meta

Might as well eat our own dogfood...
---
 Documentation/dc-dlvr-spam-flow.txt |  2 +-
 README                              |  2 +-
 examples/public-inbox.psgi          | 14 +++++++++++++-
 examples/unsubscribe.psgi           |  3 ++-
 lib/PublicInbox/Unsubscribe.pm      |  2 +-
 lib/PublicInbox/WwwStream.pm        |  6 +++---
 6 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/Documentation/dc-dlvr-spam-flow.txt b/Documentation/dc-dlvr-spam-flow.txt
index 5a7e290..d151d27 100644
--- a/Documentation/dc-dlvr-spam-flow.txt
+++ b/Documentation/dc-dlvr-spam-flow.txt
@@ -45,4 +45,4 @@ delivery path as well as removing the message from the git tree.
 * spamc / spamd - SpamAssassin: http://spamassassin.apache.org/
 
 * report-spam / dc-dlvr - distributed with public-inbox in the scripts/
-  directory: git clone git://80x24.org/public-inbox
+  directory: git clone https://public-inbox.org/public-inbox.git
diff --git a/README b/README
index a91c45b..ca4e2a8 100644
--- a/README
+++ b/README
@@ -87,7 +87,7 @@ Hacking
 
 Source code is available via git:
 
-	git clone git://80x24.org/public-inbox
+	git clone https://public-inbox.org/public-inbox.git
 
 See below for contact info.
 
diff --git a/examples/public-inbox.psgi b/examples/public-inbox.psgi
index 4edbf5e..a90a2bc 100644
--- a/examples/public-inbox.psgi
+++ b/examples/public-inbox.psgi
@@ -11,6 +11,10 @@ use PublicInbox::WWW;
 PublicInbox::WWW->preload;
 use Plack::Builder;
 my $www = PublicInbox::WWW->new;
+
+# share the public-inbox code itself:
+my $src = $ENV{SRC_GIT_DIR}; # '/path/to/public-inbox.git'
+
 builder {
 	eval {
 		enable 'Deflater',
@@ -40,5 +44,13 @@ builder {
 	#	format => '%t "%r" %>s %b %D';
 
 	enable 'Head';
-	sub { $www->call(@_) };
+	sub {
+		my ($env) = @_;
+		# share public-inbox.git code!
+		if ($src && $env->{PATH_INFO} =~ m!\A/public-inbox\.git/(.*)!) {
+			PublicInbox::GitHTTPBackend::serve($env, $src, $1);
+		} else {
+			$www->call($env);
+		}
+	};
 }
diff --git a/examples/unsubscribe.psgi b/examples/unsubscribe.psgi
index beeab9f..5b9b16c 100644
--- a/examples/unsubscribe.psgi
+++ b/examples/unsubscribe.psgi
@@ -17,7 +17,8 @@ my $app = PublicInbox::Unsubscribe->new(
 		# the archives runs as a different user.
 		PublicInbox::Config->new('/home/pi/.public-inbox/config')
 	},
-	code_url => 'git://80x24.org/public-inbox.git', # change if you fork
+	# change if you fork
+	code_url => 'https://public-inbox.org/public-inbox.git',
 	owner_email => 'BOFH@example.com',
 	confirm => 0,
 
diff --git a/lib/PublicInbox/Unsubscribe.pm b/lib/PublicInbox/Unsubscribe.pm
index 79234aa..46d5d8d 100644
--- a/lib/PublicInbox/Unsubscribe.pm
+++ b/lib/PublicInbox/Unsubscribe.pm
@@ -12,7 +12,7 @@ use warnings;
 use Crypt::CBC;
 use Plack::Util;
 use MIME::Base64 qw(decode_base64url);
-my $CODE_URL = 'git://80x24.org/public-inbox.git';
+my $CODE_URL = 'https://public-inbox.org/public-inbox.git';
 my @CT_HTML = ('Content-Type', 'text/html; charset=UTF-8');
 
 sub new {
diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm
index d9abb5a..97a6dc7 100644
--- a/lib/PublicInbox/WwwStream.pm
+++ b/lib/PublicInbox/WwwStream.pm
@@ -7,7 +7,7 @@ use strict;
 use warnings;
 use PublicInbox::Hval qw(ascii_html);
 use URI;
-use constant PI_URL => 'https://public-inbox.org/README.html';
+use constant PI_URL => 'https://public-inbox.org/public-inbox.git';
 
 sub new {
 	my ($class, $ctx, $cb) = @_;
@@ -86,8 +86,8 @@ sub _html_end {
 	'<pre>'.join("\n",
 		'- ' . $desc,
 		$urls,
-		'served with software from public-inbox: '
-			."<a\nhref=\"$url\">$url</a>",
+		'Archived served using code from public-inbox:',
+		"\tgit clone $url",
 	).'</pre></body></html>';
 }
 

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

* [PATCH 3/2] git: allow cloning from the URL root, too
  2016-07-01  1:17 [PATCH 0/2] HTTPS smart git repository for our code Eric Wong
  2016-07-01  1:17 ` [PATCH 1/2] githttpbackend: allow git to be a regular scalar string Eric Wong
  2016-07-01  1:17 ` [PATCH 2/2] update git repo location to https:// using GitHTTPBackend.pm Eric Wong
@ 2016-07-01  2:15 ` Eric Wong
  2016-07-01  2:20   ` [PATCH 4/2] www_stream: fix stupid typo :x Eric Wong
  2 siblings, 1 reply; 5+ messages in thread
From: Eric Wong @ 2016-07-01  2:15 UTC (permalink / raw)
  To: meta

This means we can still show non-git users a somewhat browseable
URL with a link to the README.html file while allowing git users
to type less when cloning.

All of the following are supported:

git clone https://public-inbox.org/ public-inbox
git clone https://public-inbox.org/public-inbox
git clone https://public-inbox.org/public-inbox.git
torsocks git clone http://ou63pmih66umazou.onion/public-inbox
---
 Documentation/dc-dlvr-spam-flow.txt | 2 +-
 README                              | 2 +-
 examples/public-inbox.psgi          | 4 +++-
 lib/PublicInbox/GitHTTPBackend.pm   | 2 +-
 lib/PublicInbox/WwwStream.pm        | 4 ++--
 5 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/Documentation/dc-dlvr-spam-flow.txt b/Documentation/dc-dlvr-spam-flow.txt
index d151d27..81aba76 100644
--- a/Documentation/dc-dlvr-spam-flow.txt
+++ b/Documentation/dc-dlvr-spam-flow.txt
@@ -45,4 +45,4 @@ delivery path as well as removing the message from the git tree.
 * spamc / spamd - SpamAssassin: http://spamassassin.apache.org/
 
 * report-spam / dc-dlvr - distributed with public-inbox in the scripts/
-  directory: git clone https://public-inbox.org/public-inbox.git
+  directory: git clone https://public-inbox.org/ public-inbox
diff --git a/README b/README
index ca4e2a8..f56d68d 100644
--- a/README
+++ b/README
@@ -87,7 +87,7 @@ Hacking
 
 Source code is available via git:
 
-	git clone https://public-inbox.org/public-inbox.git
+	git clone https://public-inbox.org/ public-inbox
 
 See below for contact info.
 
diff --git a/examples/public-inbox.psgi b/examples/public-inbox.psgi
index a90a2bc..11e2a6e 100644
--- a/examples/public-inbox.psgi
+++ b/examples/public-inbox.psgi
@@ -47,7 +47,9 @@ builder {
 	sub {
 		my ($env) = @_;
 		# share public-inbox.git code!
-		if ($src && $env->{PATH_INFO} =~ m!\A/public-inbox\.git/(.*)!) {
+		if ($src && $env->{PATH_INFO} =~
+				m!\A/(?:public-inbox(?:\.git)?/)?
+				($PublicInbox::GitHTTPBackend::ANY)\z!xo) {
 			PublicInbox::GitHTTPBackend::serve($env, $src, $1);
 		} else {
 			$www->call($env);
diff --git a/lib/PublicInbox/GitHTTPBackend.pm b/lib/PublicInbox/GitHTTPBackend.pm
index 4f58c6b..b485192 100644
--- a/lib/PublicInbox/GitHTTPBackend.pm
+++ b/lib/PublicInbox/GitHTTPBackend.pm
@@ -23,7 +23,7 @@ my @binary = qw!
 	objects/pack/pack-[a-f0-9]{40}\.(?:pack|idx)
 	!;
 
-our $ANY = join('|', @binary, @text);
+our $ANY = join('|', @binary, @text, 'git-upload-pack');
 my $BIN = join('|', @binary);
 my $TEXT = join('|', @text);
 
diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm
index 97a6dc7..87a461e 100644
--- a/lib/PublicInbox/WwwStream.pm
+++ b/lib/PublicInbox/WwwStream.pm
@@ -7,7 +7,7 @@ use strict;
 use warnings;
 use PublicInbox::Hval qw(ascii_html);
 use URI;
-use constant PI_URL => 'https://public-inbox.org/public-inbox.git';
+use constant PI_URL => 'https://public-inbox.org/';
 
 sub new {
 	my ($class, $ctx, $cb) = @_;
@@ -87,7 +87,7 @@ sub _html_end {
 		'- ' . $desc,
 		$urls,
 		'Archived served using code from public-inbox:',
-		"\tgit clone $url",
+		"\tgit clone <a\nhref="$url">$url</a> public-inbox",
 	).'</pre></body></html>';
 }
 

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

* [PATCH 4/2] www_stream: fix stupid typo :x
  2016-07-01  2:15 ` [PATCH 3/2] git: allow cloning from the URL root, too Eric Wong
@ 2016-07-01  2:20   ` Eric Wong
  0 siblings, 0 replies; 5+ messages in thread
From: Eric Wong @ 2016-07-01  2:20 UTC (permalink / raw)
  To: meta

Note to self: remember to run tests

Fixes: 52052329aced ("git: allow cloning from the URL root, too")
---
 lib/PublicInbox/WwwStream.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm
index 87a461e..fdab4da 100644
--- a/lib/PublicInbox/WwwStream.pm
+++ b/lib/PublicInbox/WwwStream.pm
@@ -87,7 +87,7 @@ sub _html_end {
 		'- ' . $desc,
 		$urls,
 		'Archived served using code from public-inbox:',
-		"\tgit clone <a\nhref="$url">$url</a> public-inbox",
+		qq(\tgit clone <a\nhref="$url">$url</a> public-inbox),
 	).'</pre></body></html>';
 }
 
-- 
EW

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

end of thread, other threads:[~2016-07-01  2:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-01  1:17 [PATCH 0/2] HTTPS smart git repository for our code Eric Wong
2016-07-01  1:17 ` [PATCH 1/2] githttpbackend: allow git to be a regular scalar string Eric Wong
2016-07-01  1:17 ` [PATCH 2/2] update git repo location to https:// using GitHTTPBackend.pm Eric Wong
2016-07-01  2:15 ` [PATCH 3/2] git: allow cloning from the URL root, too Eric Wong
2016-07-01  2:20   ` [PATCH 4/2] www_stream: fix stupid typo :x 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).