mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-07 10:33:38 +00:00
Fix for tornado write issues on GET and POST methods.
This commit is contained in:
parent
1145f90208
commit
eece317c75
1 changed files with 4 additions and 5 deletions
|
@ -146,8 +146,7 @@ def redirect(url, permanent=False, status=None):
|
||||||
class MainHandler(RequestHandler):
|
class MainHandler(RequestHandler):
|
||||||
def __init__(self, application, request, **kwargs):
|
def __init__(self, application, request, **kwargs):
|
||||||
super(MainHandler, self).__init__(application, request, **kwargs)
|
super(MainHandler, self).__init__(application, request, **kwargs)
|
||||||
sickbeard.REMOTE_IP = self.request.headers.get('X-Forwarded-For',
|
sickbeard.REMOTE_IP = self.request.headers.get('X-Forwarded-For', self.request.headers.get('X-Real-Ip', self.request.remote_ip))
|
||||||
self.request.headers.get('X-Real-Ip', self.request.remote_ip))
|
|
||||||
|
|
||||||
def http_error_401_handler(self):
|
def http_error_401_handler(self):
|
||||||
""" Custom handler for 401 error """
|
""" Custom handler for 401 error """
|
||||||
|
@ -165,7 +164,7 @@ class MainHandler(RequestHandler):
|
||||||
|
|
||||||
def write_error(self, status_code, **kwargs):
|
def write_error(self, status_code, **kwargs):
|
||||||
if status_code == 401:
|
if status_code == 401:
|
||||||
self.write(self.http_error_401_handler())
|
self.finish(self.http_error_401_handler())
|
||||||
elif status_code == 404:
|
elif status_code == 404:
|
||||||
self.redirect('/home/')
|
self.redirect('/home/')
|
||||||
else:
|
else:
|
||||||
|
@ -217,13 +216,13 @@ class MainHandler(RequestHandler):
|
||||||
|
|
||||||
def get(self, *args, **kwargs):
|
def get(self, *args, **kwargs):
|
||||||
try:
|
try:
|
||||||
self.write(self._dispatch())
|
self.finish(self._dispatch())
|
||||||
except HTTPRedirect,inst:
|
except HTTPRedirect,inst:
|
||||||
self.redirect(inst.url, inst.permanent, inst.status)
|
self.redirect(inst.url, inst.permanent, inst.status)
|
||||||
|
|
||||||
def post(self, *args, **kwargs):
|
def post(self, *args, **kwargs):
|
||||||
try:
|
try:
|
||||||
self.write(self._dispatch())
|
self.finish(self._dispatch())
|
||||||
except HTTPRedirect, inst:
|
except HTTPRedirect, inst:
|
||||||
self.redirect(inst.url, inst.permanent, inst.status)
|
self.redirect(inst.url, inst.permanent, inst.status)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue