Your message dated Thu, 31 Jul 2014 11:20:48 +0200
with message-id <20140731092048.GA17967@klow>
and subject line Re: Bug#362483: rss2email: Unabled to disable 301 redirection
for select feeds
has caused the Debian Bug report #362483,
regarding rss2email: Unabled to disable 301 redirection for select feeds
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
362483: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=362483
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: rss2email
Version: 1:2.55.dfsg1-2
Severity: wishlist
I access a number of 'private' feeds associated with my university
research group. rss2email detects the 301 redirection and saves the
new (redirected) url --- but this disables access next time an attempt
is made.
I've attached a patch that uses a new command 'explicit' to prevent
select feeds from respecting the embedded redirection information.
NOTE: this patch assumes that submitted patch for #349061 has already
been applied.
-- System Information:
Debian Release: testing/unstable
APT prefers testing
APT policy: (500, 'testing')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.13-rc6
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
Versions of packages rss2email depends on:
ii python 2.3.5-5 An interactive high-level object-o
ii python-feedparser 4.1-2 Universal Feed Parser for Python
rss2email recommends no packages.
-- no debconf information
diff -ruN --exclude=debian ./rss2email-2.55.dfsg1-2-original/r2e
./rss2email-2-keh/r2e
--- ./rss2email-2.55.dfsg1-2-original/r2e 2006-03-30 10:53:05.000000000
-0700
+++ ./rss2email-2-keh/r2e 2006-03-30 10:56:00.000000000 -0700
@@ -4,4 +4,4 @@
mkdir ~/.rss2email
fi
cd ~/.rss2email/
-exec python /usr/share/rss2email/rss2email.py feeds.dat $*
+exec python /usr/share/rss2email/rss2email.py feeds.dat "${@}"
diff -ruN --exclude=debian ./rss2email-2.55.dfsg1-2-original/r2e.1
./rss2email-2-keh/r2e.1
--- ./rss2email-2.55.dfsg1-2-original/r2e.1 2006-03-30 10:53:05.000000000
-0700
+++ ./rss2email-2-keh/r2e.1 2006-04-13 11:13:11.000000000 -0600
@@ -15,8 +15,8 @@
.P
.RS
.nf
-.BI "r2e new " your@address
-.BI "r2e add " http://feed.url/somewhere.rss
+.BI "r2e new " your@address "
+.BI "r2e add " http://feed.url/somewhere.rss " [youremail] [bonus_header]"
.BI "r2e run "
.RE
.P
@@ -28,10 +28,16 @@
Create a new feedfile. If the second option is specified, it sets the
default email address that mails are sent to.
.TP
-.B add url [youremail]
-Subscribe to a feed. The first option is the URL of the feed.
-The optional second option is the email address to send new items to.
-Repeat for each feed you want to subscribe to.
+.B add url ... [youremail] [bonus_header]
+Subscribe to a feed. The leading option(s) is the URL of the feed.
+The first optional trailing argument is the email address to send new items to.
+The last optional trailing argument is an extra header added to the Email
(useful for procmail(1) processing).
+Repeat this command for each feed you want to subscribe to.
+.TP
+.B explicit url ... [youremail] [bonus_header]
+Subscribe to a feed that does not permit 301 redirection. Semantics are
identical
+to "add", but redirection information in the feed is ignored.
+Repeat this command for each feed you want to subscribe to.
.TP
.B run [--no-send] [num]
Scan the feeds and send emails for new items. This can be run in a cron
diff -ruN --exclude=debian ./rss2email-2.55.dfsg1-2-original/rss2email.py
./rss2email-2-keh/rss2email.py
--- ./rss2email-2.55.dfsg1-2-original/rss2email.py 2006-03-30
10:53:05.000000000 -0700
+++ ./rss2email-2-keh/rss2email.py 2006-04-13 11:16:13.000000000 -0600
@@ -6,7 +6,7 @@
new [youremail] (create new feedfile)
email yournewemail (update default email)
run [--no-send] [num]
- add feedurl [youremail]
+ add feedurl [youremail] [bonus_header]
list
delete n
"""
@@ -239,9 +239,11 @@
### Simple Database of Feeds ###
class Feed:
- def __init__(self, url, to):
+ def __init__(self, url, to, bonus_header, redirectable):
self.url, self.etag, self.modified, self.seen = url, None,
None, {}
self.to = to
+ self.bonus_header = bonus_header
+ self.redirect = redirectable
def load(lock=1):
if not os.path.exists(feedfile):
@@ -270,18 +272,30 @@
### Program Functions ###
-def add(*args):
- if len(args) == 2 and contains(args[1], '@') and not contains(args[1],
'://'):
- urls, to = [args[0]], args[1]
- else:
- urls, to = args, None
+def add(redirect, *args):
+ to = None
+ bonus_header = None
+ # grab bonus header
+ if len(args) > 1 :
+ if contains(args[-1], ': ') and not contains(args[1], '://'):
+ bonus_header = args[-1]
+ args = args[:-1]
+
+ # grab alternative address
+ if len(args) > 1 :
+ if contains(args[-1], '@') and not contains(args[1], '://'):
+ to = args[-1]
+ args = args[:-1]
+
+ # the rest are feeds
+ urls = args
feeds, feedfileObject = load()
if feeds and not isstr(feeds[0]) and to is None:
print "No email address has been defined. Please run 'email
newaddr' or"
print "'add url addr'."
sys.exit(1)
- for url in urls: feeds.append(Feed(url, to))
+ for url in urls: feeds.append(Feed(url, to, bonus_header, redirect))
unlock(feeds, feedfileObject)
def run(num=None):
@@ -302,7 +316,13 @@
# Handle various status conditions, as required
if 'status' in r:
- if r.status == 301: f.url = r['url']
+ if r.status == 301:
+ if f.redirect :
+ print >>warn, "W:
permanent redirection to", r['url']
+ f.url = r['url']
+ else :
+ print >>warn, "W: NOT
redirecting to", r['url']
+
elif r.status == 410:
print >>warn, "W: feed gone;
deleting", f.url
feeds.remove(f)
@@ -404,13 +424,18 @@
from_addr = unu(getEmail(r.feed, entry))
+
+ feed_bonus_header = ''
+ if f.bonus_header is not None :
+ feed_bonus_header += "\n" +
f.bonus_header
+
message = (
"From: " +
quote822(header7bit(getName(r, entry))) + " <"+from_addr+">" +
"\nTo: " + header7bit(unu(f.to or
default_to)) + # set a default email!
"\nSubject: " + header7bit(title) +
"\nDate: " + time.strftime("%a, %d %b
%Y %H:%M:%S -0000", datetime) +
"\nUser-Agent: rss2email" + # really
should be X-Mailer
- BONUS_HEADER +
+ BONUS_HEADER + feed_bonus_header +
"\nContent-Type: ") # but
backwards-compatibility
if ishtml(content):
@@ -462,7 +487,7 @@
print "default email:", default_to
else: ifeeds = feeds; i = 0
for f in ifeeds:
- print `i`+':', f.url, '('+(f.to or ('default: '+default_to))+')'
+ print `i`+':', f.url, '('+(f.to or ('default:
'+default_to))+')', 'bonus_header="%s"' % ( str(f.bonus_header),)
if not (f.to or default_to):
print " W: Please define a default address with 'r2e
email addr'"
i+= 1
@@ -506,7 +531,9 @@
else:
email(args[0])
- elif action == "add": add(*args)
+ elif action == "add": add(True, *args)
+
+ elif action == "explicit": add(False, *args)
elif action == "new":
if len(args) == 1: d = [args[0]]
--- End Message ---
--- Begin Message ---
* Keith Hellman <[email protected]> [140731 09:14]:
> I access a number of 'private' feeds associated with my university
> research group. rss2email detects the 301 redirection and saves the
> new (redirected) url --- but this disables access next time an
> attempt is made.
>
> I've attached a patch that uses a new command 'explicit' to prevent
> select feeds from respecting the embedded redirection information.
Hello,
I've been triaging old bugs and stumbled upon this one. The semantics
of a 301 redirection are clear, and according to RFC2616, rss2email as
a "clients with link editing capabilities" should change the URL in
its database. I don't know the specifics of these private URLs but
maybe another redirection such as 302 would be better.
Thanks for your bug report.
--
Etienne Millon
--- End Message ---