From ec438df7ecf06142969954182bf277927562d7e4 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 20 Mar 2014 13:03:10 -0700 Subject: [PATCH] feed: Change _USER_AGENT from '+{url}' to '({url})' In Debian bug 742215 [1], Jakup points out that the old User-Agent is out-of-spec. From RFC 2616 [2]: User-Agent = "User-Agent" ":" 1*( product | comment ) product = token ["/" product-version] product-version = token token = 1* separators = "(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\" | <"> | "/" | "[" | "]" | "?" | "=" | "{" | "}" | SP | HT comment = "(" *( ctext | quoted-pair | comment ) ")" ctext = [1]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=742215 [2]: User-Agent: https://tools.ietf.org/html/rfc2616#section-14.43 product: https://tools.ietf.org/html/rfc2616#section-3.8 token, separators, comment, ctext: https://tools.ietf.org/html/rfc2616#section-2.2 Reported-by: Jakub Wilk Signed-off-by: W. Trevor King --- CHANGELOG | 1 + rss2email/feed.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index acb542c..ec9b1c1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,5 @@ v3.9 (unreleased) + * Fix non-compliant User-Agent header for HTTP/1.1. * Fix an error in the NoToEmailAddress invocation. * Add a new `trust-link` setting, to prefer the `link` attribute over the `id` attribute for identifying entries. diff --git a/rss2email/feed.py b/rss2email/feed.py index ef4d770..b2c1350 100644 --- a/rss2email/feed.py +++ b/rss2email/feed.py @@ -57,7 +57,7 @@ from . import error as _error from . import util as _util -_USER_AGENT = 'rss2email/{} +{}'.format(__version__, __url__) +_USER_AGENT = 'rss2email/{} ({})'.format(__version__, __url__) _feedparser.USER_AGENT = _USER_AGENT _urllib_request.install_opener(_urllib_request.build_opener()) _SOCKET_ERRORS = [] -- 2.26.2