Update web-platform-tests to revision 34f9b93c2749043ba68485dea92d1fb554075e60

This commit is contained in:
WPT Sync Bot 2018-08-23 22:19:29 -04:00
parent fd64f11efe
commit ace02666c2
75 changed files with 1496 additions and 120 deletions

View file

@ -492,9 +492,10 @@ def start_servers(host, ports, paths, routes, bind_address, config, **kwargs):
for scheme, ports in ports.items():
assert len(ports) == {"http":2}.get(scheme, 1)
# TODO Not very ideal, look into removing it in the future
# Check that python 2.7.15 is being used for HTTP/2.0
# If trying to start HTTP/2.0 server, check compatibility
if scheme == 'http2' and not http2_compatible():
logger.error('Cannot start HTTP/2.0 server as the environment is not compatible. ' +
'Requires Python 2.7.10+ (< 3.0) and OpenSSL 1.0.2+')
continue
for port in ports:

View file

@ -4,7 +4,7 @@ import pytest
from six.moves.urllib.error import HTTPError
wptserve = pytest.importorskip("wptserve")
from .base import TestUsingServer
from .base import TestUsingServer, TestUsingH2Server
class TestFileHandler(TestUsingServer):
@ -40,5 +40,51 @@ class TestRequestHandler(TestUsingServer):
self.assertEqual(cm.exception.code, 500)
class TestFileHandlerH2(TestUsingH2Server):
def test_not_handled(self):
self.conn.request("GET", "/not_existing")
resp = self.conn.get_response()
assert resp.status == 404
class TestRewriterH2(TestUsingH2Server):
def test_rewrite(self):
@wptserve.handlers.handler
def handler(request, response):
return request.request_path
route = ("GET", "/test/rewritten", handler)
self.server.rewriter.register("GET", "/test/original", route[1])
self.server.router.register(*route)
self.conn.request("GET", "/test/original")
resp = self.conn.get_response()
assert resp.status == 200
assert resp.read() == b"/test/rewritten"
class TestRequestHandlerH2(TestUsingH2Server):
def test_exception(self):
@wptserve.handlers.handler
def handler(request, response):
raise Exception
route = ("GET", "/test/raises", handler)
self.server.router.register(*route)
self.conn.request("GET", "/test/raises")
resp = self.conn.get_response()
assert resp.status == 500
def test_frame_handler_exception(self):
class handler_cls:
def frame_handler(self, request):
raise Exception
route = ("GET", "/test/raises", handler_cls())
self.server.router.register(*route)
self.conn.request("GET", "/test/raises")
resp = self.conn.get_response()
assert resp.status == 500
if __name__ == "__main__":
unittest.main()

View file

@ -354,6 +354,10 @@ class Http2WebTestRequestHandler(BaseWebTestRequestHandler):
try:
while not self.close_connection:
data = self.request.recv(window_size)
if data == '':
self.logger.debug('(%s) Socket Closed' % self.uid)
self.close_connection = True
continue
with self.conn as connection:
frames = connection.receive_data(data)