Content server: Use internal redirect for single item categories

Content server: Fix single item categories not working with reverse
proxy setup. Fixes #1238987 [Calibre behind apache server sometimes returns 'localhost' URLs](https://bugs.launchpad.net/calibre/+bug/1238987)

Single item categories were using HTTP 303 redirects which are resolved to
http://localhost:8080 absolute URLs by cherrpy (since cherrypy has no
knowledge of whatever server the apache process is exposed as). SO
instead we use an internal redirect, which does not suffer from this
issue. It does mean that bookmarking the URL wil have unexpected
side-effects if the number of items in the catefory ever increases to
more than one.
This commit is contained in:
Kovid Goyal 2013-10-14 19:12:03 +05:30
parent ecf1e290b8
commit 2a336ab7a7

View File

@ -500,7 +500,7 @@ class BrowseServer(object):
datatype, self.opts.url_prefix)
href = re.search(r'<a href="([^"]+)"', html)
if href is not None:
raise cherrypy.HTTPRedirect(href.group(1))
raise cherrypy.InternalRedirect(href.group(1))
if len(items) <= self.opts.max_opds_ungrouped_items:
script = 'false'