# retrieve a html file from the server and compare it to its source def test_h2_003_02(self, env): with open(env.htdocs_src("test1/index.html"), mode='rb') as file:
src = file.read()
# test various response body lengths to work correctly def test_h2_003_40(self, env):
n = 1001 while n <= 1025024:
url = env.mkurl("https", "cgi", f"/mnot164.py?count={n}&text=X")
r = env.curl_get(url, 5) assert r.response["status"] == 200 assert"HTTP/2" == r.response["protocol"] assert n == len(r.response["body"])
n *= 2
# test various response body lengths to work correctly
@pytest.mark.parametrize("n", [
0, 1, 1291, 1292, 80000, 80123, 81087, 98452
]) def test_h2_003_41(self, env, n):
url = env.mkurl("https", "cgi", f"/mnot164.py?count={n}&text=X")
r = env.curl_get(url, 5) assert r.response["status"] == 200 assert"HTTP/2" == r.response["protocol"] assert n == len(r.response["body"])
# test ranges
@pytest.mark.parametrize("path", [ "/004.html", "/proxy/004.html", "/h2proxy/004.html"
]) def test_h2_003_50(self, env, path, repeat): # check that the resource supports ranges and we see its raw content-length
url = env.mkurl("https", "test1", path)
r = env.curl_get(url, 5) assert r.response["status"] == 200 assert"HTTP/2" == r.response["protocol"]
h = r.response["header"] assert"accept-ranges"in h assert"bytes" == h["accept-ranges"] assert"content-length"in h
clen = h["content-length"] # get the first 1024 bytes of the resource, 206 status, but content-length as original
r = env.curl_get(url, 5, options=["-H", "range: bytes=0-1023"]) assert 206 == r.response["status"] assert"HTTP/2" == r.response["protocol"] assert 1024 == len(r.response["body"]) assert"content-length"in h assert clen == h["content-length"]
# use an invalid scheme def test_h2_003_51(self, env):
url = env.mkurl("https", "cgi", "/")
opt = ["-H:scheme: invalid"]
r = env.nghttp().get(url, options=opt) assert r.exit_code == 0, r assert r.response['status'] == 400
# use an differing scheme, but one that is acceptable def test_h2_003_52(self, env):
url = env.mkurl("https", "cgi", "/")
opt = ["-H:scheme: http"]
r = env.nghttp().get(url, options=opt) assert r.exit_code == 0, r assert r.response['status'] == 200
# Test that we get a proper `Date` and `Server` headers on responses def test_h2_003_60(self, env):
url = env.mkurl("https", "test1", "/index.html")
r = env.curl_get(url) assert r.exit_code == 0, r assert r.response['status'] == 200 assert'date'in r.response['header'] assert'server'in r.response['header']
# lets do some error tests def test_h2_003_70(self, env):
url = env.mkurl("https", "cgi", "/h2test/error?status=500")
r = env.curl_get(url) assert r.exit_code == 0, r assert r.response['status'] == 500
url = env.mkurl("https", "cgi", "/h2test/error?error=timeout")
r = env.curl_get(url) assert r.exit_code == 0, r assert r.response['status'] == 408
# produce an error during response body def test_h2_003_71(self, env, repeat):
url = env.mkurl("https", "cgi", "/h2test/error?body_error=timeout")
r = env.curl_get(url) assert r.exit_code != 0, f"{r}"
url = env.mkurl("https", "cgi", "/h2test/error?body_error=reset")
r = env.curl_get(url) assert r.exit_code != 0, f"{r}"
# produce an error, fail to generate an error bucket def test_h2_003_72(self, env, repeat):
url = env.mkurl("https", "cgi", "/h2test/error?body_error=timeout&error_bucket=0")
r = env.curl_get(url) assert r.exit_code != 0, f"{r}"
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.2Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.