Commit 01ec94d2 authored by Denis Bilenko's avatar Denis Bilenko

merge

parents 96a40e5f a80ff915
......@@ -5,6 +5,7 @@ syntax: glob
dist
gevent.egg-info
build
gevent/core.c
gevent/core.so
gevent/core_d.so
doc/_build
......
......@@ -293,7 +293,7 @@ class Greenlet(greenlet):
If block is ``True`` (the default), wait until the greenlet dies or the optional timeout expires.
If block is ``False``, the current greenlet is not unscheduled.
The function always returns ``None`` and never raises an errir.
The function always returns ``None`` and never raises an error.
`Changed in version 0.13.0:` *block* is now ``True`` by default.
"""
......
......@@ -173,6 +173,8 @@ class WSGIHandler(object):
self.log_request()
break
finally:
self.socket._sock.close() # do not rely on garbage collection
self.socket.close()
self.__dict__.pop('socket', None)
self.__dict__.pop('rfile', None)
self.__dict__.pop('wfile', None)
......
......@@ -91,7 +91,7 @@ class TestCase(BaseTestCase):
@property
def testcasename(self):
return self.__class__.__name__ + '.' + self.testname
@property
def modulename(self):
test_method = getattr(self, self.testname)
......@@ -101,7 +101,6 @@ class TestCase(BaseTestCase):
def fullname(self):
return splitext(basename(self.modulename))[0] + '.' + self.testcasename
def hook_stderr(self):
if VERBOSE:
return
......
......@@ -20,6 +20,7 @@ test_socket.GeneralModuleTests.*
tests = [x.strip().replace('\.', '\\.').replace('*', '.*?') for x in tests.split('\n') if x.strip()]
tests = re.compile('^%s$' % '|'.join(tests))
def get_switch_expected(fullname):
"""
>>> get_switch_expected('test_select.SelectTestCase.test_error_conditions')
......
......@@ -858,6 +858,32 @@ Cookie: name2="value2"\n\n'''.replace('\n', '\r\n'))
read_http(fd)
class TestLeakInput(TestCase):
def application(self, environ, start_response):
pi = environ["PATH_INFO"]
self._leak_wsgi_input = environ["wsgi.input"]
self._leak_environ = environ
if pi == "/leak-frame":
environ["_leak"] = sys._getframe(0)
text = "foobar"
start_response('200 OK', [('Content-Length', str(len(text))), ('Content-Type', 'text/plain')])
return [text]
def test_connection_close_leak_simple(self):
fd = self.connect().makefile(bufsize=1)
fd.write("GET / HTTP/1.0\r\nConnection: close\r\n\r\n")
d = fd.read()
assert d.startswith("HTTP/1.0 200 OK"), "bad response"
def test_connection_close_leak_frame(self):
fd = self.connect().makefile(bufsize=1)
fd.write("GET /leak-frame HTTP/1.0\r\nConnection: close\r\n\r\n")
d = fd.read()
assert d.startswith("HTTP/1.0 200 OK"), "bad response"
del CommonTests
if __name__ == '__main__':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment