about summary refs log tree commit homepage
path: root/lib
DateCommit message (Collapse)
2016-03-05daemon: document optional Net::Server dependency
Non-socket activation users will want to install Net::Server for daemonization, pid file writing, and user/group switching.
2016-03-05feed: remove unnecessary encoding lookup
We handle encoding-related things elsewhere.
2016-03-05daemon: simplify parent death handling
No need to create a new sub which kill ourselves $$ when we can invoke worker_quit directly.
2016-03-05daemon: avoid cyclic references for once-used callbacks
Not that these subs are repeatedly created, but this makes the code easier-to-review and these callbacks are idempotent anyways.
2016-03-05daemon: drop listener sockets ASAP on termination
We do not want to be accepting connections during graceful shutdown because another new process is likely taking over. This also allows us to free up the listener case another (independent) process wants to claim it.
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-04daemon: simplify socket inheriting, slightly
IO::Handle->new_from_fd has existed since at least 1996, so it should be safe to depend on at this point.
2016-03-04daemon: support listening on Unix domain sockets
Listening on Unix domain sockets can be convenient for running behind reverse proxies, avoiding port conflicts, limiting access, or avoiding the overhead (if any) of TCP over loopback.
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-03view: fix stupid typo in inline_dump
Ugh, this enabled-iff-xapian-is-available code really needs better testing...
2016-03-03use raw header for Message-ID
Message-IDs should not be MIME encoded, but in case they are, use the raw form for compatibility with ssoma and possibly other tools. This prevents a potential problem where a malicious client could confuse our storage layer into indexing incorrect contents.
2016-03-01http: better error handling for EMFILE/ENFILE
Better to throw the error back to the client ASAP if we're out-of-descriptors. We will need to implement idle client expiration for long-lived HTTP connections.
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-03-01processpipe: preserve native close behavior
We need to ensure close on handles tied to this class get the same errors a normal "close" in Perl gets.
2016-03-01linkify: do not capture trailing '.' or ';' in URLs
It seems common for users to end statements with URLs, while it is rare for a URL itself to end with a '.' or ';'. So make a guess and assume the URL was intended to not include the trailing '.' or ';'
2016-03-01extract linkification code to a separate package
This will allow us to more easily reuse it elsewhere.
2016-03-01view: consolidate whitespace stripping from messages
We now keep intermediate blank lines in messages, since it could be used to denote logical gaps in the message (such as giving readers a chance to opt out of "spoiler" information). However leading blank lines, trailing blank lines, and trailing whitespace have no useful value we can discern; so drop those entirely to prevent clients from eating up vertical whitespace.
2016-03-01view: do not hide patches or signatures
It's often not that much information and may be useful to reduce HTTP requests a reader will want to make.
2016-02-29fixup Plack-related requires
We do not need to load Plack::Request outside of WWW anymore.
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-29spawnpp: use env(1) for mod_perl compatibility
We cannot modify %ENV directly under mod_perl (even after forking!), so use env(1) instead to pass the environment.
2016-02-29git-http-backend: stricter parsing of CRLF
It is not needed as we know git uses CRLF termination.
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-29distinguish error messages intended for users vs developers
For error messages intended to show user error (e.g. giving invalid options), we add a newline ("\n") at the end to polluting the output with location information. However, for diagnosing non-user-triggered errors, we should show the location of where the error occured.
2016-02-29http: avoid needless time2str calls
Checking the time is nearly free on modern systems with vDSO/vsyscall/similar while sprintf is always expensive.
2016-02-29http: document event_write usage
It may not be obvious where we are when we enter the event_write callback. Hopefully this clarifies things.
2016-02-29http: error check for sysseek on input
Just in case we screwed up somewhere, we need to match up syswrite to sysseek and we also favor procedural calls for native types.
2016-02-28spawnpp: die instead of exit on exec failure
Perl may complain about exit not being executed, but not die.
2016-02-28newswww: set Content-Type properly
Oops :x
2016-02-28http: support graceful shutdown like nntp
HTTP responses may be long-running or requests may be slow or pipelined. Ensure we don't kill them off prematurely.
2016-02-28reduce calls to close unless error checks are needed
We can rely on timely auto-destruction based on reference counting; reducing the chance of redundant close(2) calls which may hit the wront FD. We do care about certain close calls (e.g. writing to a buffered IO handle) if we require error-checking for write-integrity. In other cases, let things go out-of-scope so it can be freed automatically after use.
2016-02-28searchidx: use defined for checking EOF behavior
While empty or "0" should never appear, this allows the reviewer to think and know less about the context in which this check is done.
2016-02-28searchmsg: update + fix license header
Not sure how, but this should've always been AGPL-3.0+ like the rest of the code, not GPL-3.0+
2016-02-28spawn: disable popen optimization for non-vfork
This is necessary since we want to be able to do arbitrary redirects via the popen interface. Oh well, we'll be a little slower for now for users without vfork. vfork users will get all the performance benefits.
2016-02-28spawnpp: fix error message for stderr redirect failing
Oops :x
2016-02-27daemon: refresh before forking
This means we always load the PSGI server code early for -httpd. This may make things less compatible with existing PSGI/Plack apps, but we prioritize our httpd for the uses of public-inbox itself, first. And any existing PSGI/Plack app which wants to may adapt themselves to being preload-friendly.
2016-02-27spawn: fail properly if Inline fails
We must stash the error correctly when nesting evals, oops :x
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-27initial spawn implementation using vfork
Under Linux, vfork maintains constant performance as parent process size increases. fork needs to prepare pages for copy-on-write, requiring a linear scan of the address space.
2016-02-27http: simplify offset calculation slightly
No point in comparing an empty string; length() is only potentially expensive on big strings.
2016-02-26daemon: update comment about usage in httpd
Writing a read-only IMAP server isn't out-of-scope, either, but I've never studiied the IMAP protocol, much, unlike HTTP/1.x or even NNTP.
2016-02-26www: add News* wrappers to preload
We want to preload as much as possible in -httpd when forking to save memory via CoW.
2016-02-26www: workaround for malformed NNTP links
Some linkifiers to create invalid HTTP links when it sees a link intended for NNTP services. This means we may see links to news.public-inbox.org/inbox.comp.mail.public-inbox.meta point to "http://" on port 80 instead of 119. Try to redirect users to http://public-inbox.org/meta/ in this case.
2016-02-26support protocol-relative URLs in publicinbox.$LISTNAME.url
All URL generation in dynamic HTTP pages should be capable of generating "https" or "http" URLs depending on the user's preference.
2016-02-26git-http-backend: extract input_to_file function
This will allow us to more easily read and test later.
2016-02-26extmsg: do not modify shared array via prurl
We cannot modify elements in any shared data strucutures shared between requests. Oops!
2016-02-26extmsg: allow returning 404 responses
We will be falling back and cascading to newsgroup lookups, later.
2016-02-25httpd: fill in missing Danga::Socket callbacks
Danga::Socket will die on us if we hit the base implementations.
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).