]> Sergey Matveev's repositories - public-inbox.git/log
public-inbox.git
8 years agoexamples/public-inbox.psgi: optional deflater
Eric Wong [Fri, 11 Sep 2015 05:42:40 +0000 (05:42 +0000)]
examples/public-inbox.psgi: optional deflater

The deflater middleware isn't standard Plack, so don't require
potential users install it.

8 years agoconstent X?HTML MIME type filtering
Eric Wong [Thu, 10 Sep 2015 00:59:08 +0000 (00:59 +0000)]
constent X?HTML MIME type filtering

Filter and View should reject X?HTML the same way.

8 years agoview: change References link to expand thread
Eric Wong [Mon, 7 Sep 2015 07:02:20 +0000 (07:02 +0000)]
view: change References link to expand thread

The expanded thread view is generally more useful.  Having links
to more links at the bottom seems to a waste of navigation time.
However, keep the '#r' anchor in case people rely on it for
links.

8 years agopublic-inbox-init: use absolute path
Eric Wong [Sun, 6 Sep 2015 07:15:26 +0000 (07:15 +0000)]
public-inbox-init: use absolute path

We actually have no business expanding (e.g. translating ~ to
$HOME) paths from the command-line argument, the shell does
that.

However, we need to make the path absolute instead.

8 years agoupdate copyright headers and email addresses
Eric Wong [Sun, 6 Sep 2015 06:59:13 +0000 (06:59 +0000)]
update copyright headers and email addresses

In the future, it should be possible to use this:

    git ls-files | UPDATE_COPYRIGHT_HOLDER='all contributors' \
      UPDATE_COPYRIGHT_USE_INTERVALS=2 \
      xargs /path/to/gnulib/build-aux/update-copyright

8 years agoMakefile.PL: conform to naming conventions
Eric Wong [Sun, 6 Sep 2015 06:51:44 +0000 (06:51 +0000)]
Makefile.PL: conform to naming conventions

Not that we actually have a bare PublicInbox module, yet.
Maybe MID can be it.

8 years agoextmsg: add note about the deficiency of the implementation
Eric Wong [Sat, 5 Sep 2015 09:16:19 +0000 (09:16 +0000)]
extmsg: add note about the deficiency of the implementation

ref: http://public-inbox.org/meta/20150905091457.GA27857@dcvr.yhbt.net/

8 years agosearchview: link users to permalink instead of thread
Eric Wong [Sat, 5 Sep 2015 09:04:53 +0000 (09:04 +0000)]
searchview: link users to permalink instead of thread

The permalink should load faster if the user had a good query
and users can easily find the rest of the message in the thread.

8 years agoextmsg: fall back to partial Message-ID matching
Eric Wong [Sat, 5 Sep 2015 08:56:54 +0000 (08:56 +0000)]
extmsg: fall back to partial Message-ID matching

In case a URL gets truncated (as is common with long URLs),
we can rely on Xapian for partial matches and bring the user
to their destination.

8 years agosearch: tweak parsing for internal queries
Eric Wong [Sat, 5 Sep 2015 08:00:12 +0000 (08:00 +0000)]
search: tweak parsing for internal queries

We should not need to use QueryParser for internal queries,
but rather for external ones.

We'll also be exposing searching Message-IDs with the "mid:" prefix
for broken mids on some servers, and enabling partial searching
with 'm' to help with URL truncations.

Since thread IDs may be volatile, they cannot be exposed to the
public, there's no reason to expose them to the query parser,
either.

Also, add 's:' as an alternative probabilistic prefix to 'subject'
as it is shorter.

8 years agosearch: note why we do not support FLAG_PURE_NOT
Eric Wong [Sat, 5 Sep 2015 07:42:44 +0000 (07:42 +0000)]
search: note why we do not support FLAG_PURE_NOT

Perhaps this can be optionally enabled in the future for smaller
sites.

8 years agosearchview: error description for invalid queries
Eric Wong [Sat, 5 Sep 2015 07:23:43 +0000 (07:23 +0000)]
searchview: error description for invalid queries

Xapian may raise exceptions on some queries.  Pass the error
along to the user so they can read Xapian documentation.

8 years agosearch: use relevance as secondary sort by default
Eric Wong [Sat, 5 Sep 2015 07:22:55 +0000 (07:22 +0000)]
search: use relevance as secondary sort by default

Might as well give relevance some weight if the timestamp is tied.

8 years agosearchview: factor out dump_mset subroutine
Eric Wong [Sat, 5 Sep 2015 07:02:14 +0000 (07:02 +0000)]
searchview: factor out dump_mset subroutine

We'll be moving atom and thread display support inline
and reducing endpoints.  Maybe it makes sense, maybe not.

8 years agosearchview: improve footer navigation
Eric Wong [Sat, 5 Sep 2015 05:54:26 +0000 (05:54 +0000)]
searchview: improve footer navigation

Aallow navigating backwards and forwards, as some pages will be
bookmarked or some browsers may not have history.  Also add a
link back to the index where they presumably came from.

While we're at it, limit the number of results we have to 25
for now to avoid making the page too big and wasting clients
memory for irrelevant results.

8 years agoview: preliminary HTML search interface
Eric Wong [Sat, 5 Sep 2015 02:52:47 +0000 (02:52 +0000)]
view: preliminary HTML search interface

This hopefully makes it easier to find things without resorting
to proprietary external services.

8 years agoview: fix broken link to ghost fallback
Eric Wong [Fri, 4 Sep 2015 08:56:30 +0000 (08:56 +0000)]
view: fix broken link to ghost fallback

Once again, the regression was introduced in
commit 16ca6b7a57266fcb466ffff005bc1d644bad14c1
(view: avoid attempting to find "subject dummy")

8 years agowww: extra redirects for the '/'-challenged
Eric Wong [Fri, 4 Sep 2015 08:49:29 +0000 (08:49 +0000)]
www: extra redirects for the '/'-challenged

Omitting a slash should not be fatal if unambiguous.  Add
fallbacks so users who expect a directory structure-like
experience can have it at the cost of one extra HTTP
request/response pair.

This matches behavior of static sites.

8 years agoview: thread view expands focused message
Eric Wong [Fri, 4 Sep 2015 08:27:45 +0000 (08:27 +0000)]
view: thread view expands focused message

Non-top-level messages still deserve to be shown in full
if they're the message in the URL.

8 years agoview: indentation adjustments for collapsed headers
Eric Wong [Fri, 4 Sep 2015 05:59:59 +0000 (05:59 +0000)]
view: indentation adjustments for collapsed headers

This makes the layout between the permalink threads and
index threads more consistent; hopefully.

8 years agoview: reduce redundant attributions in permalink refs
Eric Wong [Fri, 4 Sep 2015 05:33:17 +0000 (05:33 +0000)]
view: reduce redundant attributions in permalink refs

No point in repeating authorship when PATCH messages are
threaded and it's obvious from the top message who the author
is of the series:

 [this message] - John Smith @ 2015-09-04 00:04:20 UTC
  ` [PATCH 1/4] view: eliminate redundant [threaded|flat] link
  ` [PATCH 2/4] view: one line for thread subjects
  ` [PATCH 3/4] view: adjust spacing and indentation of index threads
  ` [PATCH 4/4] view: add missing newline to inline dump

8 years agoview: add missing newline to inline dump
Eric Wong [Fri, 4 Sep 2015 05:19:26 +0000 (05:19 +0000)]
view: add missing newline to inline dump

This fixes a regression introduced in
commit 16ca6b7a57266fcb466ffff005bc1d644bad14c1
(view: avoid attempting to find "subject dummy")

8 years agoview: adjust spacing and indentation of index threads
Eric Wong [Fri, 4 Sep 2015 05:06:03 +0000 (05:06 +0000)]
view: adjust spacing and indentation of index threads

Avoid wasting precious horizontal space by indenting children
excessively relative to the top-level parent.

8 years agoview: one line for thread subjects
Eric Wong [Fri, 4 Sep 2015 04:58:42 +0000 (04:58 +0000)]
view: one line for thread subjects

We truncate subjects in the Xapian document anyways,
so lines should not be too long and it hopefully won't
throw off the vertical display.

8 years agoview: eliminate redundant [threaded|flat] link
Eric Wong [Fri, 4 Sep 2015 03:53:52 +0000 (03:53 +0000)]
view: eliminate redundant [threaded|flat] link

We do not need to waste space with that link when
we have it conveniently placed where every message
is located.

8 years agoview: do not generate anchors in thread views
Eric Wong [Fri, 4 Sep 2015 02:18:11 +0000 (02:18 +0000)]
view: do not generate anchors in thread views

They're unused, and they can have namespace conflicts if
there's multiple full messages in the thread view.

8 years agoSearchMsg: avoid encoding Message-IDs
Eric Wong [Fri, 4 Sep 2015 02:18:10 +0000 (02:18 +0000)]
SearchMsg: avoid encoding Message-IDs

Spaces may be added when using header_str with Email::MIME->create,
so use the normal "header" parameter when setting Message-IDs
and References.

8 years agoview: avoid attempting to find "subject dummy"
Eric Wong [Fri, 4 Sep 2015 02:18:09 +0000 (02:18 +0000)]
view: avoid attempting to find "subject dummy"

This is an internal Message-ID used by Mail::Thread, to group
messages with identical subjects but common parent.  Don't
attempt to redirect users to external sites when we cannot
find it.

8 years agoextmsg: close HTML tag in response
Eric Wong [Fri, 4 Sep 2015 02:18:08 +0000 (02:18 +0000)]
extmsg: close HTML tag in response

Oops, browsers normally render this fine, though.

8 years agoconsolidate thread sorting in view
Eric Wong [Fri, 4 Sep 2015 02:18:07 +0000 (02:18 +0000)]
consolidate thread sorting in view

This is a display subroutine so it should not be in our thread
monkey-patching package, but instead in the view package.

Hopefully one day in the future, Mail::Thread will be maintained
again and we'll no longer need PublicInbox::Thread at all.

8 years agoindex: use message threading if search is available
Eric Wong [Fri, 4 Sep 2015 02:18:06 +0000 (02:18 +0000)]
index: use message threading if search is available

This lets us merge topics with different subjects with a common parent
(common in "[PATCH 0/X]" threads).  This also lets us avoid forking for
the HTML index page, too.

8 years agodoc: design_www: more accessibility guidelines
Eric Wong [Fri, 4 Sep 2015 02:18:05 +0000 (02:18 +0000)]
doc: design_www: more accessibility guidelines

Despite best intentions, things like strike-throughs and italics
won't render well and will harm accessibility.

8 years agowww: move fallback after legacy matches
Eric Wong [Thu, 3 Sep 2015 08:28:54 +0000 (08:28 +0000)]
www: move fallback after legacy matches

We do not want to get legacy URLs swallowed up by our workaround
for weird and wonky servers that attempt to unescape PATH_INFO
before the app sees it.

8 years agofeed: use application/atom+xml for Content-Type
Eric Wong [Thu, 3 Sep 2015 08:27:42 +0000 (08:27 +0000)]
feed: use application/atom+xml for Content-Type

This is the correct Content-Type for Atom feeds, especially
since we updated to use ".atom" as the suffix.

8 years agoexamples/public-inbox.psgi: update with middlewares
Eric Wong [Thu, 3 Sep 2015 08:19:48 +0000 (08:19 +0000)]
examples/public-inbox.psgi: update with middlewares

HTML, text, and probably Atom feeds should be compressed.

8 years agowww: attempt to handle Message-IDs with slashes
Eric Wong [Thu, 3 Sep 2015 04:23:21 +0000 (04:23 +0000)]
www: attempt to handle Message-IDs with slashes

Unfortunately, some HTTP servers will try to be clever
with %2F and escape it to '/', making life difficult for
us.  Fortunately, not many Message-IDs have slashes in
them.

8 years agoget rid of Message-ID compression entirely
Eric Wong [Thu, 3 Sep 2015 03:00:28 +0000 (03:00 +0000)]
get rid of Message-ID compression entirely

Provide a fallback for legacy SHA-1 messages, but do not
advertise shorter URLs anymore for data portability concerns.

This fixes a regression introduced in
commit 81a9c1b476987d845b340ab9013d26cf4487cb9a
("search: disable Message-ID compression in Xapian")
which ended up breaking thread-related endpoints for
large Message-IDs, as lookups on the SHA-1 message no longer
worked.

8 years agoExtMsg: 300 to external mailing list archives
Eric Wong [Thu, 3 Sep 2015 01:57:12 +0000 (01:57 +0000)]
ExtMsg: 300 to external mailing list archives

Since cross-posting is inevitable, we shall link to external
message archives for interopability.

8 years agosearch: disable Message-ID compression in Xapian
Eric Wong [Thu, 3 Sep 2015 01:57:11 +0000 (01:57 +0000)]
search: disable Message-ID compression in Xapian

We'll continue to compress long Message-IDs in URLs (which we know
about), but we will store entire Message-IDs in the Xapian database
to facilitate ease-of-lookups in external databases.

8 years agoview: include ghost messages in thread views
Eric Wong [Thu, 3 Sep 2015 01:57:10 +0000 (01:57 +0000)]
view: include ghost messages in thread views

We'll be expanding our ghost message lookup facilities, so
it makes sense to generate links to them even if they are
currently unknown.

8 years agoimplement external Message-ID finder
Eric Wong [Wed, 2 Sep 2015 02:37:23 +0000 (02:37 +0000)]
implement external Message-ID finder

Currently, this looks at other public-inbox configurations
served in the same process.  In the future, it will generate
links to other Message-ID lookup endpoints.

8 years agoview: avoid links to unknown compressed Message-IDs
Eric Wong [Wed, 2 Sep 2015 02:37:22 +0000 (02:37 +0000)]
view: avoid links to unknown compressed Message-IDs

Compressed Message-IDs are irreversible and may not be used
at other sites.  So avoid compressing Message-IDs we do not
know about so users have a chance of finding the message in
other archives by doing a Message-ID lookup.

8 years agoview: pre-anchor entries for flat view
Eric Wong [Wed, 2 Sep 2015 02:37:21 +0000 (02:37 +0000)]
view: pre-anchor entries for flat view

This will allow users to navigate the flat view without making extra
HTTP requests.

8 years agoview: simplify parent anchoring code
Eric Wong [Wed, 2 Sep 2015 02:37:20 +0000 (02:37 +0000)]
view: simplify parent anchoring code

This will make things easier for the next commit to pre-populate
the `$seen' hash for linking within the flat view of a thread.

8 years agoview: account for missing In-Reply-To header
Eric Wong [Wed, 2 Sep 2015 02:37:19 +0000 (02:37 +0000)]
view: account for missing In-Reply-To header

Some mail clients do not generate In-Reply-To headers,
but do generate a proper References header.

This matches the behavior of Mail::Thread as well
as our SearchIdx code to link threads in the Xapian DB.

8 years agoview: optional flat view for recent messages
Eric Wong [Wed, 2 Sep 2015 02:37:18 +0000 (02:37 +0000)]
view: optional flat view for recent messages

For still-active threads, it will likely be easier to follow
them chronologically, especially if we have links to parent
messages.

8 years agoview: close possible race condition in thread view
Eric Wong [Wed, 2 Sep 2015 02:37:17 +0000 (02:37 +0000)]
view: close possible race condition in thread view

It's possible that the Xapian index and git HEAD can be out-of-sync
and a message which existed when we did the search is no longer
accessible by the time we get to rendering it.

8 years agoview: purge email address cache after rendering thread
Eric Wong [Tue, 1 Sep 2015 20:33:24 +0000 (20:33 +0000)]
view: purge email address cache after rendering thread

We cannot allow memory in the cache to grow at an unbounded
rate in between HTTP requests.

8 years agofeed: extra newline after nav footer if list footer exists
Eric Wong [Tue, 1 Sep 2015 20:33:23 +0000 (20:33 +0000)]
feed: extra newline after nav footer if list footer exists

It makes sense to distinguish the two a little.

8 years agoview: change wording to include "thread" in footer
Eric Wong [Tue, 1 Sep 2015 20:33:22 +0000 (20:33 +0000)]
view: change wording to include "thread" in footer

Hopefully make it more obvious we're downloading or following
just one thread and not everything else.

8 years agofeed: fix <updated> tag in Atom feed
Eric Wong [Tue, 1 Sep 2015 09:28:27 +0000 (09:28 +0000)]
feed: fix <updated> tag in Atom feed

Fixes commit d44ed46ee92c78aaaed64975c4d6846613963be4
("implement per-thread Atom feeds")

8 years agoview: add missing space
Eric Wong [Tue, 1 Sep 2015 08:58:27 +0000 (08:58 +0000)]
view: add missing space

This fixes a regression introduced in
commit 1b4b2c7b8b2f2df8f114617d2e875eaf5c839ce0
("completely revamp URL structure to shorten permalinks")

8 years agoview: more robust link generation
Eric Wong [Tue, 1 Sep 2015 08:55:28 +0000 (08:55 +0000)]
view: more robust link generation

We must avoid double-escaping in cases where we have URLs anchored
by "<>" in the plain-text as is common (and AFAIK recommended)
convention.  So we must use a two step linkification process
to prevent double-escaping.

8 years agoview: drop extra '</a>' tag
Eric Wong [Tue, 1 Sep 2015 08:55:27 +0000 (08:55 +0000)]
view: drop extra '</a>' tag

Oops.

8 years agocompletely revamp URL structure to shorten permalinks
Eric Wong [Tue, 1 Sep 2015 08:55:26 +0000 (08:55 +0000)]
completely revamp URL structure to shorten permalinks

This allows common /m/ links to be used without a prefix,
saving 2 precious bytes for permalinks and raw messages.

Old URLs continue to redirect.

8 years agowww: root atom feed is "new.atom" and not "atom.xml"
Eric Wong [Tue, 1 Sep 2015 08:55:25 +0000 (08:55 +0000)]
www: root atom feed is "new.atom" and not "atom.xml"

The MIME type entry for Atom feed relies on "atom",
so allow properly-configured static file servers to serve
it with the correct Content-Type header.

8 years agowww: compile mbox regexp only once
Eric Wong [Tue, 1 Sep 2015 08:55:24 +0000 (08:55 +0000)]
www: compile mbox regexp only once

No need for 'x' modifier to span more lines, though

8 years agoimplement per-thread Atom feeds
Eric Wong [Tue, 1 Sep 2015 08:55:23 +0000 (08:55 +0000)]
implement per-thread Atom feeds

This allows users to subscribe to only a single thread
with their feed reader without subscribing to the rest of
the thread.

Update our endpoint notes while we're at it.

8 years agofeed: extract atom header generation
Eric Wong [Tue, 1 Sep 2015 08:55:22 +0000 (08:55 +0000)]
feed: extract atom header generation

We'll be using it for per-thread subscriptions

8 years agofeed: use updated date based on git commit date
Eric Wong [Tue, 1 Sep 2015 08:55:21 +0000 (08:55 +0000)]
feed: use updated date based on git commit date

This will hopefully make life easier for feed readers.

8 years agosearch: show newest results first
Eric Wong [Tue, 1 Sep 2015 08:55:20 +0000 (08:55 +0000)]
search: show newest results first

Like revision control history, older stuff is less relevant,
so favor newer stuff, first.

8 years agosearch: allow querying all mail with ''
Eric Wong [Tue, 1 Sep 2015 08:55:19 +0000 (08:55 +0000)]
search: allow querying all mail with ''

This makes dumping recent topics easier, hopefully.

8 years agosearch: reduce redundant doc data
Eric Wong [Tue, 1 Sep 2015 08:55:18 +0000 (08:55 +0000)]
search: reduce redundant doc data

Redundant document data increases our database size, pull the
smsg->mid off the unique term, the smsg->ts off the value, and
only generate the formatted display date off smsg->ts.

8 years agowww: avoid BEGIN block for config loading
Eric Wong [Sun, 30 Aug 2015 10:12:54 +0000 (10:12 +0000)]
www: avoid BEGIN block for config loading

It fails the syntax check if a user does not have
~/.public-inbox/config setup.  Anyways we can safely
use ||= on a global since we do not support threads.

8 years agoview: avoid broken parent link in per-message view
Eric Wong [Sun, 30 Aug 2015 10:08:30 +0000 (10:08 +0000)]
view: avoid broken parent link in per-message view

Broken by commit f24d362fb0959cdfab37a6da0a66a985764a2752
("view: display thread outline in single-message view")

8 years agoview: remove "threadlink" from thread view
Eric Wong [Sun, 30 Aug 2015 01:51:22 +0000 (01:51 +0000)]
view: remove "threadlink" from thread view

We're already inside the thread, and our thread summary inside
/m/$MESSAGE_ID/ is already sufficient got navigate back to the
/t/$MESSAGE_ID/ page.  So I think it's sufficient to keep the
/t/$MESSAGE_ID/ page lighter with fewer links and avoid
introducing strange terminology.

In contrast, "permalink" is relatively well-known and
not an alien term to readers:

https://en.wikipedia.org/wiki/Permalink

8 years agoview: remove "threadlink" name in per-message view
Eric Wong [Sun, 30 Aug 2015 01:45:32 +0000 (01:45 +0000)]
view: remove "threadlink" name in per-message view

It's a strange word and I'm not quite comfortable with it
in a message view.  Instead, use a descriptive link for
the thread headers.

8 years agomid2path: clean MID of angle brackets '<>'
Eric Wong [Sun, 30 Aug 2015 01:26:46 +0000 (01:26 +0000)]
mid2path: clean MID of angle brackets '<>'

We screwed up and needed to fix URL generation with '<>'
in them.  Regardless, users may attempt to copy and paste
URLs with '<>' in them, do not punish them for that.

8 years agoview: fix broken threadlink
Eric Wong [Sun, 30 Aug 2015 01:20:55 +0000 (01:20 +0000)]
view: fix broken threadlink

This regression was accidentally introduced in
commit f24d362fb0959cdfab37a6da0a66a985764a2752
("view: display thread outline in single-message view")

8 years agopublic-inbox-index: resolve git directory if run inside one
Eric Wong [Sun, 30 Aug 2015 01:04:31 +0000 (01:04 +0000)]
public-inbox-index: resolve git directory if run inside one

I often forget to pass the correct path to a git directory
or run from inside one.  Fortunately git is script-friendly
and allows easily resolving the correct GIT_DIR path.

8 years agosearch: do not index references and inreplyto terms
Eric Wong [Sun, 30 Aug 2015 00:38:05 +0000 (00:38 +0000)]
search: do not index references and inreplyto terms

We no longer need them, as we can rely on index-time thread
resolution and thread merging.  This allows us to index less
data and hopefully increase efficiency.

8 years agoview: display thread outline in single-message view
Eric Wong [Sun, 30 Aug 2015 00:22:43 +0000 (00:22 +0000)]
view: display thread outline in single-message view

If Xapian search is available, we can load most of the
entire thread and show a more meaningful navigation tree
than the References: and In-Reply-To: headers.  Searching
on those headers themselves is unreliable because it is
possible for clients to omit some references.

8 years agoview: update linkification regexp to be more domain sensitive
Eric Wong [Sun, 30 Aug 2015 00:12:31 +0000 (00:12 +0000)]
view: update linkification regexp to be more domain sensitive

This avoids capturing links such as "http://#{foo}" => "http://#"
inside diffs

8 years agoview: remove dead commented line
Eric Wong [Sat, 29 Aug 2015 21:39:00 +0000 (21:39 +0000)]
view: remove dead commented line

Not needed since commit 9a2931759c3dcbd879728b49151aa3f8a641b506
("wire up to display non-suffixed Message-ID links")

8 years agoavoid length in boolean context
Eric Wong [Sat, 29 Aug 2015 21:30:27 +0000 (21:30 +0000)]
avoid length in boolean context

Perl does not currently optimize for this.

ref (from p5p):
http://mid.gmane.org/D5C27970-9176-4C7A-8B99-7D78360E67A2@pobox.com

8 years agopublic-inbox-init: make executable
Eric Wong [Sat, 29 Aug 2015 07:09:45 +0000 (07:09 +0000)]
public-inbox-init: make executable

Mainly for consistency and documentation purposes, as
"make install" automatically sets the executable bit

8 years agosearch: do not iterate through entire termlist
Eric Wong [Fri, 28 Aug 2015 00:00:47 +0000 (00:00 +0000)]
search: do not iterate through entire termlist

A document may have many terms, so this hurts performance
if we blindly iterate.  Unfortunately, we can't rely on the
order of the termlist just yet, either, so we must repeatedly
restart the search for now until we're ready to bump schema
versions.

8 years agosearch: do not load type into metadata
Eric Wong [Fri, 28 Aug 2015 00:17:59 +0000 (00:17 +0000)]
search: do not load type into metadata

Our search query already filters out ghost messages,
so it's wasteful to have type information loaded.

8 years agoGitCatFile: remove unnecessary FD_CLOEXEC setting
Eric Wong [Fri, 28 Aug 2015 00:21:46 +0000 (00:21 +0000)]
GitCatFile: remove unnecessary FD_CLOEXEC setting

Unless some idiot raises $^F, we should not have to care about
the close-on-exec flag.  Everything since Perl 3.0 seems to set
it by default, and 5.6 got more consistent about it.

8 years agoview: fix short followup links
Eric Wong [Thu, 27 Aug 2015 07:21:00 +0000 (07:21 +0000)]
view: fix short followup links

This was broken by commit 9a2931759c3dcbd879728b49151aa3f8a641b506
("wire up to display non-suffixed Message-ID links")

8 years agofilter: reject bad attachments outright
Eric Wong [Thu, 27 Aug 2015 06:41:14 +0000 (06:41 +0000)]
filter: reject bad attachments outright

Might as well be strict about it for new lists.
Importing old archives might be more of a challenge, though.

8 years agoimplement legacy redirects for old URLs
Eric Wong [Thu, 27 Aug 2015 04:34:02 +0000 (04:34 +0000)]
implement legacy redirects for old URLs

We should not break existing URLs.  Redirect them to
the newer, less-ambiguous URLs to improve cache hit
ratios.

8 years agowire up to display non-suffixed Message-ID links
Eric Wong [Thu, 27 Aug 2015 04:34:01 +0000 (04:34 +0000)]
wire up to display non-suffixed Message-ID links

These URLs are preferable in case somebody decides to get cute and
use a suffix we would've used to prevent others from linking to
their message.  The common /m/$MESSAGE_ID/ URLs are now 4 characters
shorter so may fit better on terminals.

8 years agomid: extract Message-ID from inside '<>'
Eric Wong [Thu, 27 Aug 2015 04:34:00 +0000 (04:34 +0000)]
mid: extract Message-ID from inside '<>'

This is necessary for some mailers which include comment text
in in the In-Reply-To header, merely assuming there is nothing
outside of '<>' as we were doing is not enough.

8 years agowire up shorter, less ambiguous URLs
Eric Wong [Thu, 27 Aug 2015 04:33:59 +0000 (04:33 +0000)]
wire up shorter, less ambiguous URLs

We will prefer URLs without suffixes for now to avoid ambiguity
in case a Message-ID ends with ".html", ".txt", ".mbox.gz" or
any other suffix we may use.

Static file compatibility is preserved by using a trailing slash
as most servers can/will fall back to an index.html file in this
case.

For raw text files, we will follow gmane's lead with "/raw"

8 years agowww: minor cleanups to shorten code
Eric Wong [Thu, 27 Aug 2015 04:33:58 +0000 (04:33 +0000)]
www: minor cleanups to shorten code

Less scrolling is more efficient.

8 years agowww: reduce unused arguments in internal API
Eric Wong [Thu, 27 Aug 2015 03:14:45 +0000 (03:14 +0000)]
www: reduce unused arguments in internal API

Less code is easier-to-manage, although we make a few extra
hash insertions now.

8 years agombox: close file handle for single mbox
Eric Wong [Wed, 26 Aug 2015 02:37:43 +0000 (02:37 +0000)]
mbox: close file handle for single mbox

This doesn't seem needed for actual server use, but Plack tests
complain about it

8 years agofeed: fix "created" vs "updated" diff in topics
Eric Wong [Tue, 25 Aug 2015 09:40:50 +0000 (09:40 +0000)]
feed: fix "created" vs "updated" diff in topics

This fixes a regression introduced in
commit 72c0f7c71ff28de9755dc4aee8b6ce6f0e4f2ed7
(feed: merge subjects regardless of "[PATCH vN]")

8 years agofilter: loosen regexp on type matches
Eric Wong [Tue, 25 Aug 2015 09:04:50 +0000 (09:04 +0000)]
filter: loosen regexp on type matches

part_type still contains the filename, unfortunately, so
PGP signatures were truly stripped.  Oh well, nobody cares
to verify PGP signatures anyways.

8 years agofeed: merge subjects regardless of "[PATCH vN]"
Eric Wong [Tue, 25 Aug 2015 01:55:44 +0000 (01:55 +0000)]
feed: merge subjects regardless of "[PATCH vN]"

This normalizes rerolled patches with identical topics,
but does not normalize different patches even if they are
in the same thread (for now).

8 years agosearch: implement subject summarization
Eric Wong [Tue, 25 Aug 2015 02:03:16 +0000 (02:03 +0000)]
search: implement subject summarization

We ought to summarize subjects to avoid exploding
line lengths in the web interface.

8 years agoMakefile.PL: add "syntax" target to check syntax
Eric Wong [Tue, 25 Aug 2015 02:03:15 +0000 (02:03 +0000)]
Makefile.PL: add "syntax" target to check syntax

This is necessary since Xapian may not be installed and
we may hide a lot of errors this way.

8 years agomid: mid_compressed => mid_compress
Eric Wong [Tue, 25 Aug 2015 02:03:14 +0000 (02:03 +0000)]
mid: mid_compressed => mid_compress

Consistently name mid_* functions as verbs.

8 years agosearch: only sort by relevance if requested
Eric Wong [Tue, 25 Aug 2015 01:08:02 +0000 (01:08 +0000)]
search: only sort by relevance if requested

Many of our internal search queries do not care about relevance,
but is used for proper thread displays.

8 years agoview: refactor $state as a hash
Eric Wong [Mon, 24 Aug 2015 02:25:46 +0000 (02:25 +0000)]
view: refactor $state as a hash

Using hash means we no longer have to document and remember what
every field does.  The original array form was insane premature
optimization and crazy.  Who wrote that?  Oh wait, I was on
drugs :<

8 years agomda: remove unnecessary import
Eric Wong [Sun, 23 Aug 2015 18:51:07 +0000 (18:51 +0000)]
mda: remove unnecessary import

Relying on Email::MIME means encoding is handled transparently
for us.

8 years agoview: simplify root filtering in followup display
Eric Wong [Sun, 23 Aug 2015 22:28:10 +0000 (22:28 +0000)]
view: simplify root filtering in followup display

The root message-ID may be too long to compare.  Instead,
check fields based on the consistency of our DB.

8 years agoview: case-insensitive "Re:" check for replies
Eric Wong [Sun, 23 Aug 2015 20:09:12 +0000 (20:09 +0000)]
view: case-insensitive "Re:" check for replies

This is to match what Mail::Thread nad our own search
relies on.  However, we will be more lenient on spaces,
though.

8 years agocleanup calls to header_obj
Eric Wong [Sun, 23 Aug 2015 20:05:41 +0000 (20:05 +0000)]
cleanup calls to header_obj

Dereference header_obj only once when performance may be
critical, or simplify our code by calling "header" directly on
the Email::{Simple,MIME} object if not.