about summary refs log tree commit homepage
path: root/script/public-inbox-httpd
DateCommit message (Collapse)
2020-01-11make Plack optional for non-WWW and non-httpd users
Some users just want to run -mda, -watch, and/or -nntpd. Let them run just those without forcing them to pull in a bunch of dependencies.
2019-09-27qspawn: workaround Perl 5.16.3 leak, re-enable Deflater
The httpd-supplied write callback is the leak culprit under Perl 5.16.3. undef-ing it immediately after use keeps a repeated "git fetch" loop from monotonically increasing memory and FD use on the Perl shipped with RHEL/CentOS 7.x. Other endpoints tested showed no increase in memory use under constant load with "ab -HAccept-Encoding:gzip -k", including the async psgi_qx code path used by $INBOX_URL/$OBJECT_ID/s/ via SolverGit module.
2019-09-26httpd: disable Deflater middleware by default on Perl <5.18
Testing with perl-5.16.3-294.el7_6 RPM package on RHEL/CentOS 7, the Deflater middleware triggers a leak when used in conjunction with our push-based responses from PublicInbox::Qspawn. I could not find another solution to workaround the memory leak in this case, and I could not find a specific leak fix in the perl5180delta manpage[1] which looked like it would solve our problem. Attempting to workaround the issue proved futile. Using internal Deflater-specific keys to prevent deflating in GitHTTPBackend and Qspawn did not solve the problem: $env->{"plack.skip-deflater"} = 1; $env->{"psgix.no-compress"} = 1; Nor did forcing an invalid encoding via "git fetch": git -c http.extraheader=Accept-Encoding:gzap fetch So this appears to be a problem with Plack::Util::response_cb somewhere. This does NOT appear to be a problem with ref() leaking as in DS::next_tick[2], since I couldn't find where Plack::Middleware::Deflater or Plack::Util::response_cb would be calling ref() on a blessed reference to trigger a leak. Also, oddly enough, the ref() use for backwards compatibility at the top of PublicInbox::GitHTTPBackend::serve does NOT seem to trigger a leak on 5.16.3 due to [2]: # XXX compatibility... ugh, can we stop supporting this? $git = PublicInbox::Git->new($git) unless ref($git); [1] https://perldoc.perl.org/perl5180delta.html [2] https://rt.perl.org/Public/Bug/Display.html?id=114340
2019-09-09run update-copyrights from gnulib for 2019
2019-05-14httpd: get rid of Deflater warning
Deflating responses may be done by the reverse proxy (e.g. varnish or nginx), so the warning for it could be invalid.
2019-01-20www: admin-configurable CSS via "publicinbox.css"
Maybe we'll default to a dark theme to promote energy savings... See contrib/css/README for details
2018-02-07update copyrights for 2018
Using update-copyrights from gnulib While we're at it, use the SPDX identifier for AGPL-3.0+ to ease mechanical processing.
2016-07-02www: remove Plack::Request dependency entirely
Lighter and ever-so-slightly faster! Most importantly, this won't do non-obvious stuff behind our backs like trying to parse a POST request body for a query string param.
2016-05-23http: chunk in the server, not middleware
Since PSGI does not require Transfer-Encoding: chunked or Content-Length, we cannot expect random apps we host to chunk their responses. Thus, to improve interoperability, chunk at the HTTP layer like other PSGI servers do. I'm chosing a more syscall-intensive method (via multiple send(...MSG_MORE) for now to reduce copy + packet overhead.
2016-04-25split out NNTPD and HTTPD* modules
Hopefully this modularizes things a little and allows us to work on a combined super server to save RAM.
2016-03-31httpd: remove reference to callback during close
Avoid wasting memory and the risk of a potential reference cycles by dropping the callback ASAP.
2016-03-05httpd: remove unnecessary eval
We have per-middleware evals to deal with them being missing; no need to put an eval around the whole thing and use an extra level of indentation.
2016-03-03daemon: introduce host_with_port for identifying sockets
This allows us to share more code between daemons and avoids having to make additional syscalls for preparing REMOTE_HOST and REMOTE_PORT in the PSGI env in -httpd. This will also make supporting HTTP (and NNTP) over Unix sockets easier in a future commit.
2016-03-03daemon: avoid polluting the main package
We've distilled the daemon code into one public function ("run"), so avoid polluting the main namespace and just have users prefix with the full package name for this rarely-used class.
2016-03-01httpd: remove unneeded err and out fields from class
Vestigial pieces from the nntpd code which aren't needed because the psgi env already has the "psgi.errors" key.
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-29favor procedural calls for most private functions
This makes for better compile-time checking and also helps document which calls are private for HTTP and NNTP. While we're at it, use IO::Handle::* functions procedurally, too, since we know we're working with native glob handles.
2016-02-28httpd: allow running if ReverseProxy is missing
Not everybody will be running this behind a ReverseProxy; but it's probably the likely configuration. Anyways, warn about this and also about Deflater being missing.
2016-02-27move executables to script/ directory
This seems to match more closely with what is expected of Perl packages based on how blib is used. Hopefully makes the top-level source tree less cluttered and things easier-to-find.