feed: Change _USER_AGENT from '+{url}' to '({url})'
authorW. Trevor King <wking@tremily.us>
Thu, 20 Mar 2014 20:03:10 +0000 (13:03 -0700)
committerW. Trevor King <wking@tremily.us>
Thu, 20 Mar 2014 20:09:27 +0000 (13:09 -0700)
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*<any CHAR except CTLs or separators>
  separators      = "(" | ")" | "<" | ">" | "@"
                  | "," | ";" | ":" | "\" | <">
                  | "/" | "[" | "]" | "?" | "="
                  | "{" | "}" | SP | HT
  comment         = "(" *( ctext | quoted-pair | comment ) ")"
  ctext           = <any TEXT excluding "(" and ")">

[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 <jwilk@debian.org>
Signed-off-by: W. Trevor King <wking@tremily.us>
CHANGELOG
rss2email/feed.py

index acb542ca55218e1a9b432d71a626972d308c94a1..ec9b1c1d4d2f09527df029e455c76034839f97b7 100644 (file)
--- 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.
 
index ef4d77058dde724d744cb52bb95176eecd4da8b3..b2c1350b6135e96f94eef9dede52dd27c4202d8a 100644 (file)
@@ -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 = []