about summary refs log tree commit homepage
path: root/lib/PublicInbox/GitHTTPBackend.pm
DateCommit message (Collapse)
2016-05-03git-http-backend: reduce memory use for clone/fetch
When serving large static files or large packs, we may call Danga::Socket::write directly to queue up callbacks to resume reading and defer firing them until the socket is writable. This prevents us from scheduling writes or buffering until we know the socket is writable and prevents needless buffering by Danga::Socket when faced with slow clients. For smart clones, this comes at the cost of throttling the output of "git pack-objects" to the speed of the client connection. This is probably not ideal, but is the behavior of the standard git-daemon, too; and is preferable to running the httpd out-of-memory. Buffering to the filesystem may be an option in the future...
2016-05-01git-http-backend: use real lseek for Content-Range
Since we use sysread, we must use sysseek for symmetry although PerlIO may be doing a real lseek with "seek", anyways. Fixes: 310819ea86ac ("git-http-backend: favor sysread for regular files")
2016-04-29http: improve error handling for aborted responses
We need to abort connections properly if a response is prematurely truncated. This includes problems with serving static files, since a clumsy admin or broken FS could return truncated responses and inadvertently leave a client waiting (since the client saw "Content-Length" in the header and expected a certain length).
2016-04-29git-http-backend: check EINTR as well as EAGAIN
The blocking PSGI server may cause EINTR to be hit, here.
2016-04-28githttpbackend: clamp to one smart HTTP request at-a-time
Server admins may not be able to afford to have too many git-pack-objects processes running at once. Since PSGI HTTP servers should already be configured to use multiple processes for other requests; limit concurrency of smart backends to one; and fall back to dumb responses if we're already generating a pack.
2016-04-28githttpbackend: fall back to dumb if smart HTTP is off
Using http.getanyfile still keeps the http-backend process alive, so it's better to break out of that process and handle serving entirely within the HTTP server.
2016-04-25githttpbackend: require IO::File explicitly
This is used all over the place, but may not be in the future, so ensure we explicitly load it ourselves.
2016-03-05git-http-backend: favor sysread for regular files
We do not need line buffering, here; so favor sysread to bypass extra copies which may be done by normal read.
2016-03-01httpd: document pi-httpd.async as totally unstable
We'll have to use it some more before deciding it is a public interface. I do hope for it to be a usable public interface one day for other users.
2016-02-29git-http-backend: fixes for mod_perl
Apache2 mod_perl does not give us a real file handle, so we must translate that before giving that to git-http-backend(1). Also, parse the Status: correctly for errors since we failed to set %ENV properly before the previous fix for SpawnPP
2016-02-29git-http-backend: stricter parsing of CRLF
It is not needed as we know git uses CRLF termination.
2016-02-27git: use built-in spawn implementation for vfork
This should reduce overhead of spawning git processes from our long-running httpd and nntpd servers.
2016-02-26git-http-backend: extract input_to_file function
This will allow us to more easily read and test later.
2016-02-25git-http-backend: avoid multi-arg print statemtents
Even with output buffering disabled via IO::Handle::autoflush, writes are not atomic unless it is a single argument passed to "print". Multiple arguments to "print" will show up as multiple calls to write(2) instead of a single, atomic writev(2).
2016-02-25git-http-backend: start async API for streaming
git-http-backend may take a while, ensure we can process other requests while waiting on it. We currently do this via Danga::Socket in public-inbox-httpd; but avoid exposing this internal implementation detail to the PSGI interface and instead only expose a callback via: $env->{'pi-httpd.async'}
2016-02-25git-http-backend: start refactoring to use callback
Designing for asynchronous, non-blocking operations makes adapting for synchronous, blocking operation easy. Going the other way around is not easy, so do it now and allow us to be more easily adapted for non-blocking use in the next commit...
2016-02-25use pipe for git-http-backend output
This allows us to stream the output to the client without buffering everything up-front. Next, we'll let Danga::Socket (or AE in the future) wait for readability.
2016-02-25remove direct CGI.pm support
Relying on Plack::Handler::CGI is much easier for long-term maintenance and development. Nowadays, we even include our own httpd implementation to facilitate easier deployment with PSGI/Plack.
2016-02-07support smart HTTP cloning
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.