about summary refs log tree commit homepage
DateCommit message (Collapse)
2020-03-26wwwtext: show altid instructions in config
Exposing altid dumps will help and ensure total reproducibility of existing instances. AFAIK, sqlite3(1) can't execute arbitrary code, so it's not quite as fashionable as the "curl | bash" stuff the cool people are doing, these days :P
2020-03-26inbox: altid_map becomes a method
We want to be able to preload that, as well as to access it in WwwText for a config comment in the config example.
2020-03-25www: add endpoint to retrieve altid dumps
This ensures all our indexed data, including data from altid searches (e.g. "gmane:$ARTNUM") is retrievable. It uses a "POST" request to avoid wasting cycles when invoked by crawlers, since it could potentially be several megabytes of data not indexable by search engines.
2020-03-25altid: warn about non-word prefixes
We only support searching on prefixes matching /\A\w+\z/ because Xapian requires ':' to delimit the prefix and splits on spaces without quotes. I've also verified Xapian supports multibyte UTF-8 characters, underscores, and bare numbers as search prefixes, so there's no need to restrict it beyond what Perl's UTF-8 aware \w character class offers.
2020-03-25wwwtext: show thread endpoint w/ indexlevel=basic
And show contact info when there's no indexing, at all. Installations where Xapian is too expensive can still support threading since it only depends on SQLite, so we need to inform users of what's available.
2020-03-25search: clobber -user_pfx on query parser initialization
While we don't currently reinitialize the query parser for the lifetime of a PublicInbox::Search object and have no plans to, it's incorrect to be appending to an existing array in case we reininitialize the query parser in the future.
2020-03-25qspawn: handle ENOENT (and other errors on exec)
As sqlite3(1) and other executables may become unavailable or uninstalled while a daemon runs, we need to gracefully handle errors in those cases.
2020-03-25mbox: need_gzip uses WwwStream::oneshot
This makes the error page more consistent. Not that it really matters since Compress::Raw::Zlib and IO::Compress packages have been distributed with Perl since 5.10.x. Of course, zlib itself is also a dependency of git.
2020-03-25wwwstream: oneshot sets content-length
PublicInbox::HTTP will chunk, otherwise, and that's extra overhead which isn't needed.
2020-03-25extmsg: use WwwResponse::oneshot
No reason to use the ->getline interface for small responses.
2020-03-25wwwstream: introduce oneshot API to avoid ->getline
The ->getline API is only useful for limiting memory use when streaming responses containing multiple emails or log messages. However it's unnecessary complexity and overhead for callers (PublicInbox::HTTP) when there's only a single message.
2020-03-25gzipfilter: lazy allocate the deflate context
zlib contexts are memory-intensive, particularly when used for compression. Since the gzip filter may be sitting in a limiter queue for a long period, delay the allocation we actually have data to translate, and not a moment sooner.
2020-03-25qspawn: reinstate filter support, add gzip filter
We'll be supporting gzipped from sqlite3(1) dumps for altid files in future commits. In the future (and if we survive), we may replace Plack::Middleware::Deflater with our own GzipFilter to work better with asynchronous responses without relying on memory-intensive anonymous subs.
2020-03-24daemon: unlink .oldbin PID file correctly
We need to track the PID file having ".oldbin" appended to it while a SIGUSR2 upgrade is in progress and ensure it is unlinked on SIGQUIT.
2020-03-24daemon: fix SIGUSR2 upgrade with -W0 (no workers)
Disabling workers via `-W0' blesses the contents of the @listeners array, so we need to ensure we call fcntl on the GLOB ref in ->{sock}. Add tests to ensure USR2 works regardless of whether workers are enabled or not.
2020-03-22v2: SDBM-based multi Message-ID queue
This lets us store author and committer times for deferred indexing messages with ambiguous Message-IDs. This allows us to reproducibly reindex messages with the git commit and author times when a rare message lacks Received and/or Date headers while having ambiguous Message-IDs.
2020-03-22*idx: pass smsg in even more places
We can finally get rid of the awkward, ad-hoc use of V2Writable, SearchIdx, and OverIdx args for passing {cotime} and {autime} between classes. We'll still use those git time fields internally within V2Writable and SearchIdx for (re)indexing, but that's not worth avoiding as a fallback.
2020-03-22v2: pass smsg in more places
We can pass fewer order-dependent args to V2Writable::do_idx and SearchIdxShard::index_raw by passing the smsg object, instead.
2020-03-22*idx: pass $smsg in more places instead of many args
We can pass blessed PublicInbox::Smsg objects to internal indexing APIs instead of having long parameter lists in some places. The end goal is to avoid parsing redundant information each step of the way and hopefully make things more understandable.
2020-03-22overidx: parse_references: less error-prone args
Favor `$smsg->{mid}' instead of `$mid0' to reduce parameters down-the-line, but favor passing the Email::MIME::Header object around instead of relying on the bloat-prone `$smsg->{mime}' and calling ->header_obj on it.
2020-03-22smsg: to_doc_data: use existing fields
No need to pass extra parameters to this method, since smsg has universal meanings for {blob} and {mid}.
2020-03-22rename PublicInbox::SearchMsg => PublicInbox::Smsg
Since the introduction of over.sqlite3, SearchMsg is not tied to our search functionality in any way, so stop confusing ourselves and future hackers by just calling it "PublicInbox::Smsg". Add a missing "use" in ExtMsg while we're at it.
2020-03-22v2writable: preserve timestamps from import
While v2 indexing is triggered immediately after writing the commit to the git repository, there may be a gap between when PublicInbox::Import generates a timestamp and when PublicInbox::SearchIdx sees the message. So follow the mirror indexing behavior and take the to-be-indexed (time|date)stamps directly from the git commit.
2020-03-22index: use git commit times on missing Date/Received
When indexing messages without Date: and/or Received: headers, fall back to using timestamps originally recorded by git in the commit object. This allows git mirrors to preserve the import datestamp and timestamp of a message according to what was fed into git, instead of blindly falling back to the current time.
2020-03-21t/msgtime: skip test if timezone isn't UTC
Date::Parse falls back to using the local timezone when it's missing from an email, so only test in a reasonable TZ (UTC) for server software.
2020-03-21t/www_listing: avoid 'once' warnings
We reach into the WwwListing package directly to retrieve that JSON encoder/decoder object, and we can't rely on `use' since WwwListing loading may fail if Plack is missing.
2020-03-21wwwlisting: use first successfully loaded JSON module
And not the last... I only noticed this since JSON::PP::Boolean was spewing redefinition warnings via overload.pm Fixes: 8fb8fc52420ef669 ("wwwlisting: avoid lazy loading JSON module")
2020-03-21examples/*.psgi: add examples for -httpd
public-inbox-httpd should work with any PSGI files, so make it more apparent to people reading .psgi examples.
2020-03-20viewdiff: favor `qr' to precompile regexps
We can also avoid `o' regexp modifier, since it isn't recommended by Perl upstream, anymore (although we don't have any bugs or unintended behavior because of it).
2020-03-20daemon: do more immortal allocations up front
Doing immortal allocations late can cause those allocations to end up in places where it fragments the heap. So do more things up front for long-lived daemons.
2020-03-20www: avoid `state' usage to perform allocations up-front
We want WWW->preload to get as many immortal allocations done as possible, and the `state' feature from Perl 5.10 prevents that.
2020-03-20wwwlisting: avoid lazy loading JSON module
We already lazy-load WwwListing for the CGI script, and hiding another layer of lazy-loading makes things difficult to do WWW->preload. We want long-lived processes to do all long-lived allocations up front to avoid fragmentation in the allocator, but we'll still support short-lived processes by lazy-loading individual modules in the PublicInbox::* namespace. Mixing up allocation lifetimes (e.g. doing immortal allocations while a large amount of space is taken by short-lived objects) will cause fragmentation in any allocator which favors large contiguous regions for performance reasons. This includes any malloc implementation which relies on sbrk() for the primary heap, including glibc malloc.
2020-03-20wwwlisting: favor "use" over require
"use" is also evaluated earlier than "require", so it is favorable for compile-only checking.
2020-03-20www: update ->preload for newer modules
We'll also avoid explicitly loading standard library modules like POSIX and Digest::SHA, here; instead we load our own modules and let those load whatever non-PublicInbox:: modules they need.
2020-03-20doc: standards: add references to RFC 5322 (and RFC 822)
RFC 5322 is the latest one in this line, but much documentation and even command-line options in other programs (e.g. git) refer to RFC 2822 or even RFC 822.
2020-03-19http: fix RFC conformance w.r.t. message length
We need to favor "Transfer-Encoding: chunked" over the value of the Content-Length header. We should also reject bogus, duplicate and/or unreasonable values for both these, since they can trigger unexpected behavior when combined with other HTTP parsers in proxies such as varnish, nginx, haproxy, etc... See RFC 7230 (and RFC 2616) for more details: https://tools.ietf.org/html/rfc7230 https://www.rfc-editor.org/errata_search.php?rfc=7230
2020-03-08INSTALL: refer to the proper Debian version
Debian 10.0 was released July 2019, so update our documentation to reflect that. While we're at it, fixup a broken footnote reference for Inline::C, too.
2020-03-07daemon: remove unused $parent_pipe variable
We can just create a ParentPipe and let PublicInbox::DS manage its life cycle. While we're at it, favor `\&coderef' over `*coderef' so we're explicit about it being a code ref and not some other ref type.
2020-03-07searchmsg: allow lines (and bytes) to be zero
We will occasionally see legit messages with zero lines, be sure we index that count for NNTP clients. I'm not sure about bytes being zero (aside from purged messages), but we should've dealt with that earlier up the stack.
2020-03-04git: remove POSIX::dup2 import
We rely on spawn/popen_rd for redirects, nowadays.
2020-03-04spawn: correctly handle error code
Both the C and pure Perl implementions of `pi_fork_exec' returns `-1' on error, not `undef'.
2020-03-01msgtime: assume +0000 if TZ missing when using Date::Parse
Some old emails don't have timezone offsets, since our Date::Parse code path takes a liberal interpretation of dates, fallback to using "+0000" as the timezone offset since it's closer to the actual date of the message than whatever the current date is. Reported-by: Leah Neukirchen <leah@vuxu.org> Link: https://public-inbox.org/meta/87h7zfemur.fsf@vuxu.org/ Fixes: ae80a3fdb53d7014 ("MsgTime.pm: Use strptime to compute the time zone")
2020-03-01import: drop '<' and '>' characters in addresses
Some strange "From:" lines will cause Email::Address::XS to leave '<' (and presumably '>') in the address which git-fast-import won't accept even if quoted. Workaround this problem by deleting '<' and '>' the same way we delete them for the ident name. Reported-by: Leah Neukirchen <leah@vuxu.org> Link: https://public-inbox.org/meta/87h7zfemur.fsf@vuxu.org/
2020-03-01INSTALL: update for 1.3.0+, clarify IO::Compress
IO::Compress is required for v2 inboxes and overview indices, after all, but it is often pulled in by other packages (HTTP::Message via Plack::Test).
2020-03-01doc: design_www: document offline friendliness
This isn't anything new and has been a part of the design since the beginning, but it may not be apparent to some folks.
2020-02-27searchview: improve naming and simplify hash override
`%over' could be confused for the overview SQLite DB instance, so call it `%override', instead. There's also no need to write a loop to override a hash when the language can do it for us.
2020-02-27doc: 1.4.0 release notes update
Perhaps 1.4.0 will be a small release, after all (and also smaller in terms of memory use :)
2020-02-24v2writable: lookup_content => content_exists
It only needs to return a boolean, since none of the current callers care about the return value. Thus avoid a hash table assignment and use of `$smsg->{mime}', here.
2020-02-24v2writable: make remove return-compatible w/ Import::remove
Import::remove is a documented interface, and the return value of the V2Writable work-alike should try to be compatible with what Import implements.
2020-02-24examples/nginx_proxy: convert CRLF to LF
It was the only file in our tree which had CRLF line endings, so make it consistent with the rest.