user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 12/12] nntp: article lookups by Message-ID may cross newsgroups
  2015-09-19  2:03  5% [PATCH 0/12] nntp: misc updates Eric Wong
@ 2015-09-19  2:03  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2015-09-19  2:03 UTC (permalink / raw)
  To: meta

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.
---
 lib/PublicInbox/NNTP.pm | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index 80adb65..d513953 100644
--- a/lib/PublicInbox/NNTP.pm
+++ b/lib/PublicInbox/NNTP.pm
@@ -330,7 +330,7 @@ sub cmd_quit ($) {
 
 sub art_lookup ($$$) {
 	my ($self, $art, $set_headers) = @_;
-	my $ng = $self->{ng} or return '412 no newsgroup has been selected';
+	my $ng = $self->{ng};
 	my ($n, $mid);
 	my $err;
 	if (defined $art) {
@@ -339,10 +339,18 @@ sub art_lookup ($$$) {
 			$n = int($art);
 			goto find_mid;
 		} elsif ($art =~ /\A<([^>]+)>\z/) {
-			$err = '430 no such article found';
 			$mid = $1;
-			$n = $ng->mm->num_for($mid);
-			defined $mid or return $err;
+			$err = '430 no such article found';
+			$n = $ng->mm->num_for($mid) if $ng;
+			goto found if defined $n;
+			foreach my $g (values %{$self->{nntpd}->{groups}}) {
+				$n = $g->mm->num_for($mid);
+				if (defined $n) {
+					$ng = $g;
+					goto found;
+				}
+			}
+			return $err;
 		} else {
 			return r501;
 		}
@@ -351,10 +359,11 @@ sub art_lookup ($$$) {
 		$n = $self->{article};
 		defined $n or return $err;
 find_mid:
+		$ng or return '412 no newsgroup has been selected';
 		$mid = $ng->mm->mid_for($n);
 		defined $mid or return $err;
 	}
-
+found:
 	my $o = 'HEAD:' . mid2path($mid);
 	my $s = eval { Email::Simple->new($ng->gcf->cat_file($o)) };
 	return $err unless $s;
-- 
EW


^ permalink raw reply related	[relevance 7%]

* [PATCH 0/12] nntp: misc updates
@ 2015-09-19  2:03  5% Eric Wong
  2015-09-19  2:03  7% ` [PATCH 12/12] nntp: article lookups by Message-ID may cross newsgroups Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2015-09-19  2:03 UTC (permalink / raw)
  To: meta

Still not changing or adding new caches or modifying our data layout,
but things seem to work well for the common case.

The most important change is the new long response API which will help
us even after any future optimizations we make.  We should be able to
stream millions of messages without excessive buffering and memory
usage.

Eric Wong (12):
      nntp: use write_buf_size instead write_buf
      nntp: introduce long response API for streaming
      nntp: use long response API for LISTGROUP
      nntp: implement command argument checking
      nntp: XOVER does not require range
      nntp: speed up XHDR for the Message-ID case
      nntp: implement XROVER, speed up XHDR for some cases
      nntp: implement XPATH
      nntp: fix logging of long responses
      nntp: fix ARTICLE/HEAD/BODY/STAT
      nntp: log to FDs given by the Nntpd module
      nntp: article lookups by Message-ID may cross newsgroups

 lib/PublicInbox/Msgmap.pm    |  24 +--
 lib/PublicInbox/NNTP.pm      | 419 ++++++++++++++++++++++++++++++++-----------
 lib/PublicInbox/SearchMsg.pm |   1 +
 public-inbox-nntpd           |   2 +
 4 files changed, 330 insertions(+), 116 deletions(-)


^ permalink raw reply	[relevance 5%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2015-09-19  2:03  5% [PATCH 0/12] nntp: misc updates Eric Wong
2015-09-19  2:03  7% ` [PATCH 12/12] nntp: article lookups by Message-ID may cross newsgroups Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).