diff options
author | Eric Wong <e@80x24.org> | 2016-02-07 08:35:29 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-02-07 08:46:37 +0000 |
commit | 0af0bd903b9b5aede71155ce8756e01a229b40bb (patch) | |
tree | 0b41dd9fa5540c89b3bff8f6af9b5e06721bb56c /lib/PublicInbox/WWW.pm | |
parent | e31f5bf979f8316cd6156410357026b3df392f81 (diff) | |
download | public-inbox-0af0bd903b9b5aede71155ce8756e01a229b40bb.tar.gz |
This requires POST and (small file) upload support from the PSGI/Plack web server. CGI.pm is currently not supported with this feature. We'll serve everything git can handle by default for performance in the general case. To avoid introducing cognitive overhead for sysadmins managing existing HTTP backends, we do not introduce new configuration directives. Thus, setting http.uploadpack=false in the relevant git config file for each public-inbox (ssoma) git repo will disable smart HTTP for CPU/memory-constrained systems. Technically we could support http.receivepack to allow posting messages to a public-inbox over HTTP(S), but that breaks the public-inbox model of encouraging users to Cc: everyone. Again, we encourage users to Cc: everyone to reduce the chance of a public-inbox becoming a centralized point of failure/censorship.
Diffstat (limited to 'lib/PublicInbox/WWW.pm')
-rw-r--r-- | lib/PublicInbox/WWW.pm | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm index 1c6936f7..b4b012f9 100644 --- a/lib/PublicInbox/WWW.pm +++ b/lib/PublicInbox/WWW.pm @@ -18,7 +18,7 @@ use URI::Escape qw(uri_escape_utf8 uri_unescape); use constant SSOMA_URL => 'http://ssoma.public-inbox.org/'; use constant PI_URL => 'http://public-inbox.org/'; require PublicInbox::Git; -use PublicInbox::GitHTTPDumb; +use PublicInbox::GitHTTPBackend; our $LISTNAME_RE = qr!\A/([\w\.\-]+)!; our $MID_RE = qr!([^/]+)!; our $END_RE = qr!(f/|T/|t/|t\.mbox(?:\.gz)?|t\.atom|raw|)!; @@ -28,10 +28,17 @@ sub run { my ($cgi, $method) = @_; $pi_config ||= PublicInbox::Config->new; my $ctx = { cgi => $cgi, pi_config => $pi_config }; - if ($method !~ /\AGET|HEAD\z/) { + my $path_info = $cgi->path_info; + + if ($method eq 'POST' && + $path_info =~ m!$LISTNAME_RE/(git-upload-pack)\z!) { + my $path = $2; + return (invalid_list($ctx, $1) || + serve_git($cgi, $ctx->{git}, $path)); + } + elsif ($method !~ /\AGET|HEAD\z/) { return r(405, 'Method Not Allowed'); } - my $path_info = $cgi->path_info; # top-level indices and feeds if ($path_info eq '/') { @@ -44,7 +51,7 @@ sub run { invalid_list($ctx, $1) || get_atom($ctx); } elsif ($path_info =~ m!$LISTNAME_RE/ - ($PublicInbox::GitHTTPDumb::ANY)\z!ox) { + ($PublicInbox::GitHTTPBackend::ANY)\z!ox) { my $path = $2; invalid_list($ctx, $1) || serve_git($cgi, $ctx->{git}, $path); } elsif ($path_info =~ m!$LISTNAME_RE/$MID_RE/$END_RE\z!o) { @@ -402,7 +409,7 @@ sub msg_page { sub serve_git { my ($cgi, $git, $path) = @_; - PublicInbox::GitHTTPDumb::serve($cgi, $git, $path); + PublicInbox::GitHTTPBackend::serve($cgi, $git, $path); } 1; |