1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-04 07:02:26 -05:00

Reverted changes made to Tornado source code, caused a bad file descriptor error

This commit is contained in:
echel0n 2014-11-27 03:45:41 -08:00
parent bfea9329b4
commit f13cffc24d
6 changed files with 11 additions and 20 deletions

View File

@ -1,3 +0,0 @@
Libs with customisations...
/tornado

View File

@ -619,7 +619,8 @@ def initialize(consoleLogging=True):
ANON_REDIRECT = check_setting_str(CFG, 'General', 'anon_redirect', 'http://dereferer.org/?')
PROXY_SETTING = check_setting_str(CFG, 'General', 'proxy_setting', '')
PROXY_INDEXERS = bool(check_setting_int(CFG, 'General', 'proxy_indexers', 1))
# attempt to help prevent users from breaking links by using a bad url
# attempt to help prevent users from breaking links by using a bad url
if not ANON_REDIRECT.endswith('?'):
ANON_REDIRECT = ''

View File

@ -165,16 +165,14 @@ class Api(webserve.MainHandler):
self.set_header("Content-Type", "application/json")
try:
out = json.dumps(dict, indent=self.intent, ensure_ascii=False, sort_keys=True)
if 'jsonp' in self.request.query_arguments:
out = self.request.arguments['jsonp'] + '(' + out + ');' # wrap with JSONP call if requested
callback = self.request.headers.get('callback', None) or self.request.headers.get('jsonp', None)
if callback != None:
out = callback + '(' + out + ');' # wrap with JSONP call if requested
except Exception, e: # if we fail to generate the output fake an error
logger.log(u"API :: " + traceback.format_exc(), logger.DEBUG)
out = '{"result":"' + result_type_map[RESULT_ERROR] + '", "message": "error while composing output: "' + ex(
e) + '"}'
tornado_write_hack_dict = {'unwrap_json': out}
return tornado_write_hack_dict
return out
def _grand_access(self, realKey, args, kwargs):
""" validate api key and log result """

View File

@ -686,9 +686,8 @@ class HTTP1ServerConnection(object):
# This exception was already logged.
conn.close()
return
except Exception as e:
if 1 != e.errno:
gen_log.error("Uncaught exception", exc_info=True)
except Exception:
gen_log.error("Uncaught exception", exc_info=True)
conn.close()
return
if not ret:

View File

@ -601,9 +601,8 @@ class BaseIOStream(object):
pos = self._read_to_buffer_loop()
except UnsatisfiableReadError:
raise
except Exception as e:
if 1 != e.errno:
gen_log.warning("error on read", exc_info=True)
except Exception:
gen_log.warning("error on read", exc_info=True)
self.close(exc_info=True)
return
if pos is not None:

View File

@ -652,10 +652,7 @@ class RequestHandler(object):
if not isinstance(chunk, (bytes, unicode_type, dict)):
raise TypeError("write() only accepts bytes, unicode, and dict objects")
if isinstance(chunk, dict):
if 'unwrap_json' in chunk:
chunk = chunk['unwrap_json']
else:
chunk = escape.json_encode(chunk)
chunk = escape.json_encode(chunk)
self.set_header("Content-Type", "application/json; charset=UTF-8")
chunk = utf8(chunk)
self._write_buffer.append(chunk)