1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-04 15:12:23 -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/?') ANON_REDIRECT = check_setting_str(CFG, 'General', 'anon_redirect', 'http://dereferer.org/?')
PROXY_SETTING = check_setting_str(CFG, 'General', 'proxy_setting', '') PROXY_SETTING = check_setting_str(CFG, 'General', 'proxy_setting', '')
PROXY_INDEXERS = bool(check_setting_int(CFG, 'General', 'proxy_indexers', 1)) 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('?'): if not ANON_REDIRECT.endswith('?'):
ANON_REDIRECT = '' ANON_REDIRECT = ''

View File

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

View File

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

View File

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

View File

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