]> Sergey Matveev's repositories - public-inbox.git/log
public-inbox.git
8 years agoTODO: updates for done stuff, and add item for message threading
Eric Wong [Wed, 18 Nov 2015 01:42:50 +0000 (01:42 +0000)]
TODO: updates for done stuff, and add item for message threading

Of course, we need to figure out if RFC 4685 is supported anywhere,
first.

8 years agoview: remove "created" and "updated" noise words
Eric Wong [Wed, 18 Nov 2015 01:36:55 +0000 (01:36 +0000)]
view: remove "created" and "updated" noise words

They increase HTML size and add to visual noise without telling
enough useful information.

8 years agofilter: fix handling of bad attachments
Eric Wong [Thu, 15 Oct 2015 18:31:50 +0000 (18:31 +0000)]
filter: fix handling of bad attachments

Improve error messages and use a better regexp for detecting
printable characters in attachments.

8 years agoview: fixup bad comparison
Eric Wong [Thu, 8 Oct 2015 20:08:47 +0000 (20:08 +0000)]
view: fixup bad comparison

Oops, there is no longer a 3rd element.

Fixes: 759efc037728a766ee80f1b0d3c1fd7b8c76a05f
("view: remove attribution for topics in top-level view")

8 years agoview: remove attribution for topics in top-level view
Eric Wong [Thu, 8 Oct 2015 00:49:04 +0000 (00:49 +0000)]
view: remove attribution for topics in top-level view

It clutters up the page unnecessarily, as identity of the topic
starter/updater probably doesn't matter if there's no exact
message to attribute the message to.

8 years agoREADME: add OpenSSL exception
Eric Wong [Mon, 5 Oct 2015 04:44:28 +0000 (04:44 +0000)]
README: add OpenSSL exception

Network connections may use OpenSSL for TLS (as other libraries,
such as GNUTLS do not appear well-supported under Perl).  So
give this exception in case somebody needs TLS support for NNTP.

8 years agombox: generate Archived-At, List-Post, List-Archive headers
Eric Wong [Sun, 4 Oct 2015 00:47:20 +0000 (00:47 +0000)]
mbox: generate Archived-At, List-Post, List-Archive headers

Downloaded mboxen can be archived/stored indefinitely, try to
make it easy for future archaelogists to find the online
archive location.

8 years agombox: kill Bytes meta-header, too
Eric Wong [Sun, 4 Oct 2015 00:28:20 +0000 (00:28 +0000)]
mbox: kill Bytes meta-header, too

It may be present in messages imported from NNTP.

8 years agoview: add links for mbox and atom feeds in homepage
Eric Wong [Sun, 4 Oct 2015 00:13:47 +0000 (00:13 +0000)]
view: add links for mbox and atom feeds in homepage

Having per-thread Atom feeds and downloadable mboxen is powerful
and should be more easily visible/accessible to casual readers.

8 years agomda: support a 'filter=scrub' option for external lists
Eric Wong [Sat, 3 Oct 2015 10:18:07 +0000 (10:18 +0000)]
mda: support a 'filter=scrub' option for external lists

For list where we are not the primary archival entry point,
defaulting to filter=scrub makes sense since their list
conventions may be more tolerant of HTML and other crap
than we are.

8 years agodrop Message-IDs longer than 244 bytes
Eric Wong [Sat, 3 Oct 2015 10:02:33 +0000 (10:02 +0000)]
drop Message-IDs longer than 244 bytes

Xapian has this limit for terms, and there are likely no
legitimate Message-IDs (or single header lines) this long; so
there's no need to workaround this limit.

8 years agorename mid_compress to id_compress
Eric Wong [Fri, 2 Oct 2015 21:15:07 +0000 (21:15 +0000)]
rename mid_compress to id_compress

We use it as a general compressor for identifiers such as
subject paths, so using the "mid_" prefix probably is not
appropriate.

8 years agonntpd: executable permission
Eric Wong [Fri, 2 Oct 2015 20:43:38 +0000 (20:43 +0000)]
nntpd: executable permission

Ensure we are executable for consistency and documentation.
MakeMaker already makes this executable, but we might as
well do the same...

8 years agoMsgmap: pass ReadOnly DBI flag for non-writable opens
Eric Wong [Fri, 2 Oct 2015 18:35:12 +0000 (18:35 +0000)]
Msgmap: pass ReadOnly DBI flag for non-writable opens

This doesn't seem to do anything on my older system, but maybe it
will in newer or future versions of DBD::SQLite.  Anyways it can
be helpful for documentation purposes, too.

8 years agosearchidx: subject is not a term
Eric Wong [Thu, 1 Oct 2015 23:53:25 +0000 (23:53 +0000)]
searchidx: subject is not a term

Sometimes subjects are excessively long and hit Xapian's 245-byte
term limit.  We can still perform subject-only searches with
a probabilistic prefix.

8 years agonntp: better delimit error message
Eric Wong [Thu, 1 Oct 2015 23:31:13 +0000 (23:31 +0000)]
nntp: better delimit error message

It may be hard to tell what command triggered an error,
otherwise.

8 years agonntp: remove reference to non-existent function
Eric Wong [Thu, 1 Oct 2015 22:38:04 +0000 (22:38 +0000)]
nntp: remove reference to non-existent function

Oops

8 years agonntp: implement idle time expiration
Eric Wong [Thu, 1 Oct 2015 22:10:31 +0000 (22:10 +0000)]
nntp: implement idle time expiration

We don't want to waste precious server memory on clients which
have been idle for longer than 3 minutes.

8 years agofilter: more consistent labeling of rejections
Eric Wong [Thu, 1 Oct 2015 20:44:27 +0000 (20:44 +0000)]
filter: more consistent labeling of rejections

While we're at it, reject non-plain-text top-level messages,
too.  They probably do not exist in practice, but we cannot
afford to scrub given policies implemented by overzealous
mail providers.

While we're at it, update the comment for strip_multipart.

8 years agosearchview: fix syntax error
Eric Wong [Thu, 1 Oct 2015 20:16:35 +0000 (20:16 +0000)]
searchview: fix syntax error

Oops, I forgot to run the syntax check for this.

8 years agofilter: do not strip Reply-To
Eric Wong [Thu, 1 Oct 2015 20:04:30 +0000 (20:04 +0000)]
filter: do not strip Reply-To

It's often part of idiotic policies to prevent mailing lists
from working at all.

8 years agomda: keep DKIM crap
Eric Wong [Thu, 1 Oct 2015 19:20:03 +0000 (19:20 +0000)]
mda: keep DKIM crap

This is probably unsafe

8 years agoview: correctly pick latest in index anchor links
Eric Wong [Thu, 1 Oct 2015 05:57:19 +0000 (05:57 +0000)]
view: correctly pick latest in index anchor links

The last message in a thread _display_ is not necessarily the
latest message in the thread.  We must go by the Date: header
on the messages themselves as a best-guess.  Of course Date:
headers may lie, but most mail clients trust them by default,
so we will, too.

8 years agoREADME: document NNTP access
Eric Wong [Wed, 30 Sep 2015 21:25:51 +0000 (21:25 +0000)]
README: document NNTP access

That's right, we now have our NNTP server running and are
self-hosting a read-only news gateway at:

nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta

8 years agoview: use '+' instead of '%20' to escape spaces in mailto:
Eric Wong [Wed, 30 Sep 2015 21:17:14 +0000 (21:17 +0000)]
view: use '+' instead of '%20' to escape spaces in mailto:

'+' is more shoter and more readable in query parameters than '%20'

8 years agot/nntpd.t: additional tests for XHDR/HDR
Eric Wong [Wed, 30 Sep 2015 21:00:27 +0000 (21:00 +0000)]
t/nntpd.t: additional tests for XHDR/HDR

More testing is good, especially since clients I use
don't implement all the commands.

8 years agot/nntpd.t: simplify condition for response termination
Eric Wong [Wed, 30 Sep 2015 21:00:26 +0000 (21:00 +0000)]
t/nntpd.t: simplify condition for response termination

Multiline responses must end with "\r\n.\r\n", so we won't
break out early in case the OS doesn't support MSG_MORE.

8 years agonntp: implement OVER/XOVER summary in search document
Eric Wong [Wed, 30 Sep 2015 21:00:25 +0000 (21:00 +0000)]
nntp: implement OVER/XOVER summary in search document

The document data of a search message already contains a good chunk
of the information needed to respond to OVER/XOVER commands quickly.
Expand on that and use the document data to implement OVER/XOVER
quickly.

This adds a dependency on Xapian being available for nntpd usage,
but is probably alright since nntpd is esoteric enough that anybody
willing to run nntpd will also want search functionality offered
by Xapian.

This also speeds up XHDR/HDR with the To: and Cc: headers and
:bytes/:lines article metadata used by some clients for header
displays and marking messages as read/unread.

8 years agonntp: implement LIST HEADERS
Eric Wong [Wed, 30 Sep 2015 21:00:24 +0000 (21:00 +0000)]
nntp: implement LIST HEADERS

We shall remove slow, unoptimized headers in XHDR/HDR to avoid
becoming an easy DoS target.

8 years agonntp: MODE READER denies posting
Eric Wong [Wed, 30 Sep 2015 21:00:23 +0000 (21:00 +0000)]
nntp: MODE READER denies posting

Redundantly confirm to clients we do not accept posting with the
MODE READER command.

ref: RFC 3977 5.3.1

8 years agoINSTALL: document Danga::Socket dependency for nntpd
Eric Wong [Wed, 30 Sep 2015 21:00:22 +0000 (21:00 +0000)]
INSTALL: document Danga::Socket dependency for nntpd

We don't have something like CGI or Plack to build an NNTP
server on top on, so we implemented one using Danga::Socket
for epoll/kqueue abstraction.

8 years agonntpd: avoid lazy require
Eric Wong [Wed, 30 Sep 2015 21:00:21 +0000 (21:00 +0000)]
nntpd: avoid lazy require

We cannot avoid requiring ::Config, so do not hide it.

8 years agodaemon: always autoflush stdout/stderr
Eric Wong [Wed, 30 Sep 2015 21:00:20 +0000 (21:00 +0000)]
daemon: always autoflush stdout/stderr

Users may log output to a pipe, so ensure these outputs are
unbuffered in userspace and go to the operating system ASAP
for other processes to pick up.

8 years agoremove unnecessary fields usage
Eric Wong [Wed, 30 Sep 2015 21:00:19 +0000 (21:00 +0000)]
remove unnecessary fields usage

It doesn't actually give performance improvements unless we
use types with "my", but we don't do that.  We'll only continue
using fields with Danga::Socket-derived classes where they're
required.

8 years agonntp: reduce syscalls for LIST OVERVIEW.FMT
Eric Wong [Wed, 30 Sep 2015 21:00:18 +0000 (21:00 +0000)]
nntp: reduce syscalls for LIST OVERVIEW.FMT

No point in sending such a short, bounded response with
multiple syscalls.

8 years agonntp: HDR returns 225, not 224
Eric Wong [Wed, 30 Sep 2015 21:00:17 +0000 (21:00 +0000)]
nntp: HDR returns 225, not 224

This is stipulated by RFC 3977 8.5.1, but apparently I misread it.

8 years agosearch: remove get_subject_path
Eric Wong [Wed, 30 Sep 2015 21:00:16 +0000 (21:00 +0000)]
search: remove get_subject_path

We probably won't be supporting this in the public API

8 years agodaemon: fix various permissions + daemon issues
Eric Wong [Fri, 25 Sep 2015 08:21:43 +0000 (08:21 +0000)]
daemon: fix various permissions + daemon issues

When using user-switching in a single process, we must be
careful to not inadvertantly create new Msgmap sqlite3 files.
We must also ensure we set proper permissions on any files
we create.

Additionally, our refactoring was broken as we failed to
actually daemonize or preserve the parent FD in a worker
process.

Finally, default to one worker process since our code may
be fatally broken and it's nice to be able to scale to multiple
cores via SIGTTIN if needed.

8 years agonntp: avoid signals for long responses
Eric Wong [Fri, 25 Sep 2015 02:27:57 +0000 (02:27 +0000)]
nntp: avoid signals for long responses

Using a signal-based timer can hurt throughput on a machine that's
overloaded.  Ensure there's always forward progress and reduce the
number of syscalls we make, too.

8 years agogit: use fields for GitCatFile
Eric Wong [Fri, 25 Sep 2015 02:27:56 +0000 (02:27 +0000)]
git: use fields for GitCatFile

Micro-optimization, but it make using Danga::Socket for watching
pipe readability easier at some point.

8 years agogit: signal-safety for pipe writes
Eric Wong [Fri, 25 Sep 2015 02:27:55 +0000 (02:27 +0000)]
git: signal-safety for pipe writes

I've yet to hit it, but syswrite has chance of returning EINTR
on a blocking pipe.

8 years agonntp: prefix FD on every log line
Eric Wong [Fri, 25 Sep 2015 02:27:54 +0000 (02:27 +0000)]
nntp: prefix FD on every log line

This can help us track down what request patterns clients
will perform when we have multiple clients.

8 years agonntp: do not repeat result on blocked write
Eric Wong [Fri, 25 Sep 2015 02:27:53 +0000 (02:27 +0000)]
nntp: do not repeat result on blocked write

Oops, we must increment our range even if we yield or
get blocked on output buffering.

8 years agosearchidx: remove unused sub: next_doc_id
Eric Wong [Fri, 25 Sep 2015 02:27:52 +0000 (02:27 +0000)]
searchidx: remove unused sub: next_doc_id

It seems like it was never used

8 years agonntp: consistently use 501 for unsupported LIST
Eric Wong [Fri, 25 Sep 2015 02:27:51 +0000 (02:27 +0000)]
nntp: consistently use 501 for unsupported LIST

This is required by RFC 3977, section 3.2.1

8 years agonntp: HDR allows metadata prefixed with ':'
Eric Wong [Fri, 25 Sep 2015 02:27:50 +0000 (02:27 +0000)]
nntp: HDR allows metadata prefixed with ':'

RFC 3977, section 8.5.2 states metadata lookups can be done
with HDR.

8 years agonntpd: hoist out daemon management code
Eric Wong [Thu, 24 Sep 2015 21:28:51 +0000 (21:28 +0000)]
nntpd: hoist out daemon management code

We'll probably be supporting read-only IMAP, or maybe
we'll just implement a custom HTTP server so users can
manage/upgrade the same way as the nntpd while being
immune to slow clients.

8 years agonntpd: support SIGUSR2 in single-process mode, too
Eric Wong [Thu, 24 Sep 2015 03:37:21 +0000 (03:37 +0000)]
nntpd: support SIGUSR2 in single-process mode, too

We may support SIGUSR2 in single-process mode as long
as permissions aren't wonky.

8 years agonntpd: better encapsulation for shutdown
Eric Wong [Thu, 24 Sep 2015 03:37:20 +0000 (03:37 +0000)]
nntpd: better encapsulation for shutdown

We can use the UNIVERSAL::can to better encapsulate the shutdown
process, in case we need to implement a gopher or HTTP daemon.

8 years agonntp: avoid infinite loop on partial read
Eric Wong [Thu, 24 Sep 2015 03:37:19 +0000 (03:37 +0000)]
nntp: avoid infinite loop on partial read

Oops :x

8 years agonntpd: move busy check to NNTP package
Eric Wong [Thu, 24 Sep 2015 03:37:18 +0000 (03:37 +0000)]
nntpd: move busy check to NNTP package

This is better encapsulated and hopefully more readable.
While we're at it, check for being inside a long response, too.

8 years agonntpd: hard quit after 30s
Eric Wong [Thu, 24 Sep 2015 03:37:17 +0000 (03:37 +0000)]
nntpd: hard quit after 30s

We don't want clients hogging server resources and preventing
us from shutting down, so give them 30s to finish whatever
request they're getting.

8 years agonntpd: additional daemonization options
Eric Wong [Thu, 24 Sep 2015 03:37:16 +0000 (03:37 +0000)]
nntpd: additional daemonization options

This should fully support the signals used by nginx and starman,
so scripts used by nginx can be used to manage our nntpd daemon,
too.

8 years agonntp: fix XOVER command
Eric Wong [Thu, 24 Sep 2015 03:37:15 +0000 (03:37 +0000)]
nntp: fix XOVER command

Oops, we need to test commands more closely :x
Add a missing prototype while we're at it for extra
checking.

8 years agonntp: support HDR command from RFC 3977
Eric Wong [Wed, 23 Sep 2015 02:21:24 +0000 (02:21 +0000)]
nntp: support HDR command from RFC 3977

This is similar to XHDR, but differs in how it handles Message-ID
lookups.

8 years agonntp: XHDR lookups by Message-ID may cross groups
Eric Wong [Tue, 22 Sep 2015 10:09:48 +0000 (10:09 +0000)]
nntp: XHDR lookups by Message-ID may cross groups

This is allowed by RFC 2980 and HDR (to-be-implemented) in
RFC 3977 supports it, too.

8 years agonntp: XHDR fixes for Message-ID lookups
Eric Wong [Tue, 22 Sep 2015 10:09:47 +0000 (10:09 +0000)]
nntp: XHDR fixes for Message-ID lookups

We'll require some modifications for HDR support, though.

8 years agonntp: implement OVER from RFC 3977
Eric Wong [Tue, 22 Sep 2015 10:09:46 +0000 (10:09 +0000)]
nntp: implement OVER from RFC 3977

This is just like the XOVER command, but allows a single Message-ID
to be given.

8 years agonntp: avoid setting Bytes and Lines headers
Eric Wong [Tue, 22 Sep 2015 10:09:45 +0000 (10:09 +0000)]
nntp: avoid setting Bytes and Lines headers

These are internal metadata should be calculated, so avoid
leaking it into the header.

8 years agonntp: ensure body lines end with CRLF
Eric Wong [Tue, 22 Sep 2015 10:09:44 +0000 (10:09 +0000)]
nntp: ensure body lines end with CRLF

It's common for mail bodies to end with LF-only, so end them with
CRLF to avoid triggering errors in clients.

8 years agonntp: support YYYYMMDD dates for commands
Eric Wong [Tue, 22 Sep 2015 10:09:43 +0000 (10:09 +0000)]
nntp: support YYYYMMDD dates for commands

RFC 3977 supports YYYYMMDD dates while retaining backwards
compatibility for old YYMMDD dates.

8 years agot/nntpd.t: fix fcntl test to ensure no failures
Eric Wong [Tue, 22 Sep 2015 10:09:42 +0000 (10:09 +0000)]
t/nntpd.t: fix fcntl test to ensure no failures

We need to run the syscall before testing for its failure :x

8 years agonntp: proper UTF-8 support (hopefully?)
Eric Wong [Mon, 21 Sep 2015 11:11:12 +0000 (11:11 +0000)]
nntp: proper UTF-8 support (hopefully?)

RFC 3977 stipulates the use of UTF-8 as the default charset,
so we shall try using that and hopefully not mangle things.

8 years agoremove bytes:: for length checks
Eric Wong [Mon, 21 Sep 2015 11:11:11 +0000 (11:11 +0000)]
remove bytes:: for length checks

Apparently, my mental model of Perl internals is still incorrect
after all these years.  I am but a simple *nix programmer:
everything is a bag of bytes to me.

This fixes a problem with UTF-8 headers from Xapian (via
"XHDR Subject [range]") triggering partial writes and writing an
extra newline to the outputs.

8 years agot/nntpd.t: improve test runnability
Eric Wong [Mon, 21 Sep 2015 11:11:10 +0000 (11:11 +0000)]
t/nntpd.t: improve test runnability

The created socket FD number may not be 3 in the test,
force it to be so inside the child process.

8 years agonntp: speed up xover slightly
Eric Wong [Mon, 21 Sep 2015 11:11:09 +0000 (11:11 +0000)]
nntp: speed up xover slightly

Reserializing the message to a string to check size wastes
considerable time and should be able to get by with slightly
less accuracy.

8 years agonntp: speed up XHDR Xref for rtin
Eric Wong [Mon, 21 Sep 2015 11:11:08 +0000 (11:11 +0000)]
nntp: speed up XHDR Xref for rtin

We could also start displaying Xref in XOVER as rtin seems to
prefer it.  Anyways this is nearly 100 times faster now and
requires no DB changes.

8 years agomsgmap: minor cleanup to move constant declaration
Eric Wong [Mon, 21 Sep 2015 11:11:07 +0000 (11:11 +0000)]
msgmap: minor cleanup to move constant declaration

This doesn't actually change anything as the constant is still
usable in other subroutines, but helps with consistency and
readability IMHO.

8 years agonntp: add "newsgroup" parameter and sort grouplist
Eric Wong [Sun, 20 Sep 2015 09:34:52 +0000 (09:34 +0000)]
nntp: add "newsgroup" parameter and sort grouplist

Using non-hierarchical mailing list names for newsgroups
might confuse traditional newsreader software and perhaps
some humans.  Allow administrators to configure newsgroups
names and hierarchies to their liking.

Sorting the grouplist alphabetically should probably be
done anyways to improve usability for some clients which
won't sort themselves.

8 years agonewsgroup: use only the first address
Eric Wong [Sun, 20 Sep 2015 09:33:45 +0000 (09:33 +0000)]
newsgroup: use only the first address

public-inboxen may be aliased to multiple email addresses,
and we have always favored the first.

8 years agonntp: fix handling of trickled responses
Eric Wong [Sun, 20 Sep 2015 03:36:11 +0000 (03:36 +0000)]
nntp: fix handling of trickled responses

We cannot use the push_back_read functionality of Danga::Socket
since it will trigger event_read on buffered data.  This would
allow a malicious (or badly implemented) client to burn CPU
without actually sending us anything.

So we still do buffering ourselves and play some tricks with
timers re-enable readability.

8 years agonntp: do not re-enable reads during long responses
Eric Wong [Sun, 20 Sep 2015 03:11:09 +0000 (03:11 +0000)]
nntp: do not re-enable reads during long responses

Long responses may leave the buffer momentarily empty,
but we must prevent read events from firing at that point.

8 years agonntpd: support systemd FD inheritance + signals
Eric Wong [Sat, 19 Sep 2015 08:42:58 +0000 (08:42 +0000)]
nntpd: support systemd FD inheritance + signals

Avoid depending on IO::Socket::INET if we can help it,
we do not need to bloat ourselves with lot of that
functionality.

8 years agonntp: article lookups by Message-ID may cross newsgroups
Eric Wong [Sat, 19 Sep 2015 02:03:40 +0000 (02:03 +0000)]
nntp: article lookups by Message-ID may cross newsgroups

Lynx seems to rely on this behavior for "ARTICLE <message-id>"

Tested with Lynx Version 2.8.8dev.12 (22 Feb 2012) on Debian wheezy.

8 years agonntp: log to FDs given by the Nntpd module
Eric Wong [Sat, 19 Sep 2015 02:03:39 +0000 (02:03 +0000)]
nntp: log to FDs given by the Nntpd module

This will allow us to redirect stdout/stderr more easily
for logging.

8 years agonntp: fix ARTICLE/HEAD/BODY/STAT
Eric Wong [Sat, 19 Sep 2015 02:03:38 +0000 (02:03 +0000)]
nntp: fix ARTICLE/HEAD/BODY/STAT

Article number is optional, but we need to update the
article number of the client connection if it was specified
(but not if it was given a Message-ID) as stipulated by
RFC 977

8 years agonntp: fix logging of long responses
Eric Wong [Sat, 19 Sep 2015 02:03:37 +0000 (02:03 +0000)]
nntp: fix logging of long responses

It's misleading to show short times on long responses.
Instead, show the long response as a separate entry on
completion or failure.

8 years agonntp: implement XPATH
Eric Wong [Sat, 19 Sep 2015 02:03:36 +0000 (02:03 +0000)]
nntp: implement XPATH

This may be helpful for sorting out duplicates.

8 years agonntp: implement XROVER, speed up XHDR for some cases
Eric Wong [Sat, 19 Sep 2015 02:03:35 +0000 (02:03 +0000)]
nntp: implement XROVER, speed up XHDR for some cases

Using Xapian allows us to implement XROVER without forking
new processes.

8 years agonntp: speed up XHDR for the Message-ID case
Eric Wong [Sat, 19 Sep 2015 02:03:34 +0000 (02:03 +0000)]
nntp: speed up XHDR for the Message-ID case

We can use our msgmap database to implement "XHDR Message-ID [range]"
commands quickly.  This helps immensely with slrnpull, which prefers
XHDR to LISTGROUP for some reason...

8 years agonntp: XOVER does not require range
Eric Wong [Sat, 19 Sep 2015 02:03:33 +0000 (02:03 +0000)]
nntp: XOVER does not require range

XOVER uses the current article if no range is given as
stipulated in RFC 2980.

8 years agonntp: implement command argument checking
Eric Wong [Sat, 19 Sep 2015 02:03:32 +0000 (02:03 +0000)]
nntp: implement command argument checking

Validate commands to make sure we do not accidentally screw up
some things or leave out some argument checking.

8 years agonntp: use long response API for LISTGROUP
Eric Wong [Sat, 19 Sep 2015 02:03:31 +0000 (02:03 +0000)]
nntp: use long response API for LISTGROUP

LISTGROUP can be expensive for giant groups, too.  Use the
long response API to improve fairness and prevent excessive
buffering.

8 years agonntp: introduce long response API for streaming
Eric Wong [Sat, 19 Sep 2015 02:03:30 +0000 (02:03 +0000)]
nntp: introduce long response API for streaming

XOVER, NEWNEWS, XHDR responses may be arbitrarily long and cause
memory usage via buffering.  This problem would exist even if we
were to optimize them by caching headers for fast retrieval and
search.

Introduce a generic API to handle all of these commands fairly
without triggering excessive buffering and unfairness of the
existing implementation.

Generating these responses is still expensive for now, but at least
the implementation is fair to other clients and prevents one client
from using one of these commands to monopolize resources away from
other clients.

8 years agonntp: use write_buf_size instead write_buf
Eric Wong [Sat, 19 Sep 2015 02:03:29 +0000 (02:03 +0000)]
nntp: use write_buf_size instead write_buf

It is shorter code and probably faster than checking an
array.

8 years agoread-only NNTP server
Eric Wong [Fri, 18 Sep 2015 01:37:53 +0000 (01:37 +0000)]
read-only NNTP server

Implementing NEWNEWS, XHDR, XOVER efficiently will require
additional caching on top of msgmap.

This seems to work with lynx and slrnpull, haven't tried clients.

DO NOT run in production, yet, denial-of-service vulnerabilities
await!

8 years agoview: do not shorten top-level messages in thread view
Eric Wong [Wed, 16 Sep 2015 10:05:13 +0000 (10:05 +0000)]
view: do not shorten top-level messages in thread view

The thread root is usually the most important, and should
be displayed in full.

8 years agoadd cgit commit-filter example
Eric Wong [Tue, 15 Sep 2015 22:01:37 +0000 (22:01 +0000)]
add cgit commit-filter example

public-inbox has search functionality, so take advantage of
good commit messages with proper titles to lookup discussion.

8 years agoINSTALL: document DBD::SQLite and DBI dependencies
Eric Wong [Tue, 15 Sep 2015 01:08:04 +0000 (01:08 +0000)]
INSTALL: document DBD::SQLite and DBI dependencies

They're optional, but probably highly useful.

8 years agoextmsg: wire up to use msgmap for prefixes
Eric Wong [Tue, 15 Sep 2015 01:08:03 +0000 (01:08 +0000)]
extmsg: wire up to use msgmap for prefixes

DBI + DBD::SQLite has much better handling of prefix lookups
than Xapian.  While we're at it, avoid linking blatantly wrong
Message-IDs to external services.

8 years agosearchidx: sync Msgmap database along with Xapian
Eric Wong [Tue, 15 Sep 2015 01:08:02 +0000 (01:08 +0000)]
searchidx: sync Msgmap database along with Xapian

We can avoid duplicating work of extracting messages from git if we
tie this to Xapian.  Of course, this ties the two features together,
but it's probably reasonable to expect that anybody who wants to use
public-inbox to serve messages to front-end users will have both.

8 years agosearchidx: hoist out rlog code
Eric Wong [Tue, 15 Sep 2015 01:08:01 +0000 (01:08 +0000)]
searchidx: hoist out rlog code

We'll be reusing this for loading msgmap.

8 years agomsgmap: add message mapping via SQLite
Eric Wong [Tue, 15 Sep 2015 01:08:00 +0000 (01:08 +0000)]
msgmap: add message mapping via SQLite

This will allow us to maintain stable article numbers for an
NNTP server independently of Xapian.

8 years agosearchview: do not link Atom feed by relevance
Eric Wong [Mon, 14 Sep 2015 00:04:30 +0000 (00:04 +0000)]
searchview: do not link Atom feed by relevance

Atom feeds only make sense when sorted by time, not when our
search indexing rules change and affect relevance.  So do not
include the relevance option when linking to Atom feeds.

However, we shall still honor the 'r' query parameter in case
somebody wants to manually include that in the URL for
testing/experimental purposes.  We simply will not advertise
it.

8 years agoview: jump to anchor of current message on References
Eric Wong [Sun, 13 Sep 2015 23:31:58 +0000 (23:31 +0000)]
view: jump to anchor of current message on References

Otherwise it could be a bit disorienting to jump to the
first message in the thread without navigation context.

8 years agoview: do not show References unless a message has them
Eric Wong [Sun, 13 Sep 2015 23:29:54 +0000 (23:29 +0000)]
view: do not show References unless a message has them

It's a waste of space and potentially confusing.

8 years agoview: use header_obj to avoid extra method calls
Eric Wong [Sun, 13 Sep 2015 23:28:53 +0000 (23:28 +0000)]
view: use header_obj to avoid extra method calls

Email::MIME will call the header_obj each time anyways, avoid
the extra method lookups and hit header_obj directly for the
header lookup.

8 years agoview: extra Atom feed link in standalone message view
Eric Wong [Sun, 13 Sep 2015 23:25:05 +0000 (23:25 +0000)]
view: extra Atom feed link in standalone message view

It might be helpful if user agents do not display the <link>
element in <head>.

8 years agoview: add Atom links in headers for per-message links
Eric Wong [Sun, 13 Sep 2015 22:35:47 +0000 (22:35 +0000)]
view: add Atom links in headers for per-message links

Some user agents will advertise the presence of a feed this
way for users to subscribe to individual topics.

8 years agosearchview: implement Atom feed for search results
Eric Wong [Sun, 13 Sep 2015 22:35:46 +0000 (22:35 +0000)]
searchview: implement Atom feed for search results

This can be helpful for folks who want to subscribe
to a particular topic or keyword.