def test_200_14(self, env): conf = HttpdConf(env) conf.add(""" LimitRequestFields 20 """) conf.add_vhost_cgi() conf.install() assert env.apache_restart() == 0 url = env.mkurl("https", "cgi", "/") opt = [] for i in range(21): opt += ["-H", "x{0}: 1".format(i)] r = env.curl_get(url, options=opt) assert 431 == r.response["status"] conf = HttpdConf(env) conf.add(""" LimitRequestFields 0 """) conf.add_vhost_cgi() conf.install() assert env.apache_restart() == 0 url = env.mkurl("https", "cgi", "/") opt = [] for i in range(100): opt += ["-H", "x{0}: 1".format(i)] r = env.curl_get(url, options=opt) assert 200 == r.response["status"]
def test_105_01(self, env): conf = HttpdConf(env) conf.add(""" AcceptFilter http none Timeout 1.5 """) conf.add_vhost_cgi() conf.install() assert env.apache_restart() == 0 host = 'localhost' # read with a longer timeout than the server sock = socket.create_connection((host, int(env.https_port))) try: # on some OS, the server does not see our connection until there is # something incoming sock.send(b'0') sock.settimeout(4) buff = sock.recv(1024) assert buff == b'' except Exception as ex: print(f"server did not close in time: {ex}") assert False sock.close() # read with a shorter timeout than the server sock = socket.create_connection((host, int(env.https_port))) try: sock.settimeout(0.5) sock.recv(1024) assert False except Exception as ex: print(f"as expected: {ex}") sock.close()
def _class_scope(self, env): env.setup_data_1k_1m() conf = HttpdConf(env) conf.add_vhost_cgi(h2proxy_self=True) conf.add("LogLevel proxy_http2:trace2") conf.add("LogLevel proxy:trace2") conf.install() assert env.apache_restart() == 0
def test_200_16(self, env): conf = HttpdConf(env) conf.add_vhost_cgi() conf.install() assert env.apache_restart() == 0 url = env.mkurl("https", "cgi", "/hello.py") opt = ["-H:method: GET /hello.py"] r = env.nghttp().get(url, options=opt) assert r.exit_code == 0, r assert r.response assert r.response["status"] == 400 url = env.mkurl("https", "cgi", "/proxy/hello.py") r = env.nghttp().get(url, options=opt) assert r.exit_code == 0, r assert r.response assert r.response["status"] == 400
def _class_scope(self, env): conf = HttpdConf(env) conf.add_vhost_cgi() conf.start_vhost(env.https_port, "pad0", doc_root="htdocs/cgi", with_ssl=True) conf.add("Protocols h2 http/1.1") conf.add("H2Padding 0") conf.add("AddHandler cgi-script .py") conf.end_vhost() conf.start_vhost(env.https_port, "pad1", doc_root="htdocs/cgi", with_ssl=True) conf.add("Protocols h2 http/1.1") conf.add("H2Padding 1") conf.add("AddHandler cgi-script .py") conf.end_vhost() conf.start_vhost(env.https_port, "pad2", doc_root="htdocs/cgi", with_ssl=True) conf.add("Protocols h2 http/1.1") conf.add("H2Padding 2") conf.add("AddHandler cgi-script .py") conf.end_vhost() conf.start_vhost(env.https_port, "pad3", doc_root="htdocs/cgi", with_ssl=True) conf.add("Protocols h2 http/1.1") conf.add("H2Padding 3") conf.add("AddHandler cgi-script .py") conf.end_vhost() conf.start_vhost(env.https_port, "pad8", doc_root="htdocs/cgi", with_ssl=True) conf.add("Protocols h2 http/1.1") conf.add("H2Padding 8") conf.add("AddHandler cgi-script .py") conf.end_vhost() conf.install() assert env.apache_restart() == 0
def test_105_03(self, env): conf = HttpdConf(env) conf.add(""" Timeout 10 RequestReadTimeout handshake=1 header=5 body=10 """) conf.add_vhost_cgi() conf.install() assert env.apache_restart() == 0 url = env.mkurl("https", "cgi", "/necho.py") r = env.curl_get(url, 5, [ "-vvv", "-F", ("count=%d" % 100), "-F", ("text=%s" % "abcdefghijklmnopqrstuvwxyz"), "-F", ("wait1=%f" % 1.5), ]) assert 200 == r.response["status"]
def test_200_15(self, env): conf = HttpdConf(env) conf.add(""" LimitRequestLine 48 """) conf.add_vhost_cgi() conf.install() assert env.apache_restart() == 0 url = env.mkurl("https", "cgi", "/") r = env.curl_get(url) assert 200 == r.response["status"] url = env.mkurl("https", "cgi", "/" + (48 * "x")) r = env.curl_get(url) assert 414 == r.response["status"] # nghttp sends the :method: header first (so far) # trigger a too long request line on it # the stream will RST and we get no response url = env.mkurl("https", "cgi", "/") opt = ["-H:method: {0}".format(100 * "x")] r = env.nghttp().get(url, options=opt) assert r.exit_code == 0, r assert not r.response
def _class_scope(self, env): env.setup_data_1k_1m() conf = HttpdConf(env).add("H2OutputBuffering off") conf.add_vhost_cgi(h2proxy_self=True).install() assert env.apache_restart() == 0
def _class_scope(self, env): conf = HttpdConf(env) conf.add_vhost_cgi() conf.install() assert env.apache_restart() == 0