"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test/e2e/test_500_proxy.py" between
mod_http2-1.15.16.tar.gz and mod_http2-1.15.17.tar.gz

About: mod_h[ttp]2 is an Apache httpd module implementing the HTTP2 protocol. It uses nghttp2 as base engine and connects it with the Apache infrastructure. Hint: Module (previous name "mod_h2") now integrated into Apache httpd (since v2.4.17). Experimental release.

test_500_proxy.py  (mod_http2-1.15.16):test_500_proxy.py  (mod_http2-1.15.17)
# #
# mod-h2 test suite # mod-h2 test suite
# check HTTP/1.1 proxied backend # check HTTP/1.1 proxied backend
# #
import copy
import os import os
import re import re
import sys
import time
import pytest import pytest
from datetime import datetime
from TestEnv import TestEnv from TestEnv import TestEnv
from TestHttpdConf import HttpdConf from TestHttpdConf import HttpdConf
def setup_module(module): def setup_module(module):
print("setup_module: %s" % module.__name__) print("setup_module: %s" % module.__name__)
TestEnv.init() TestEnv.init()
TestEnv.setup_data_1k_1m() TestEnv.setup_data_1k_1m()
HttpdConf().add_vhost_cgi( proxy_self=True ).install() HttpdConf().add_vhost_cgi( proxy_self=True ).install()
assert TestEnv.apache_restart() == 0 assert TestEnv.apache_restart() == 0
skipping to change at line 52 skipping to change at line 48
assert "" == r["response"]["json"]["ssl_protocol"] assert "" == r["response"]["json"]["ssl_protocol"]
assert "" == r["response"]["json"]["h2"] assert "" == r["response"]["json"]["h2"]
assert "" == r["response"]["json"]["h2push"] assert "" == r["response"]["json"]["h2push"]
# upload and GET again using curl, compare to original content # upload and GET again using curl, compare to original content
def curl_upload_and_verify(self, fname, options=None): def curl_upload_and_verify(self, fname, options=None):
url = TestEnv.mkurl("https", "cgi", "/proxy/upload.py") url = TestEnv.mkurl("https", "cgi", "/proxy/upload.py")
fpath = os.path.join(TestEnv.GEN_DIR, fname) fpath = os.path.join(TestEnv.GEN_DIR, fname)
r = TestEnv.curl_upload(url, fpath, options=options) r = TestEnv.curl_upload(url, fpath, options=options)
assert r["rv"] == 0 assert r["rv"] == 0
assert r["response"]["status"] >= 200 and r["response"]["status"] < 300 assert 200 <= r["response"]["status"] < 300
# why is the scheme wrong? # why is the scheme wrong?
r2 = TestEnv.curl_get(re.sub(r'http:', 'https:', r["response"]["header"] ["location"])) r2 = TestEnv.curl_get(re.sub(r'http:', 'https:', r["response"]["header"] ["location"]))
assert r2["rv"] == 0 assert r2["rv"] == 0
assert r2["response"]["status"] == 200 assert r2["response"]["status"] == 200
with open(TestEnv.e2e_src( fpath ), mode='rb') as file: with open(TestEnv.e2e_src( fpath ), mode='rb') as file:
src = file.read() src = file.read()
assert src == r2["response"]["body"] assert src == r2["response"]["body"]
def test_500_10(self): def test_500_10(self):
skipping to change at line 74 skipping to change at line 70
self.curl_upload_and_verify( "data-10k", [ "--http2" ] ) self.curl_upload_and_verify( "data-10k", [ "--http2" ] )
self.curl_upload_and_verify( "data-100k", [ "--http2" ] ) self.curl_upload_and_verify( "data-100k", [ "--http2" ] )
self.curl_upload_and_verify( "data-1m", [ "--http2" ] ) self.curl_upload_and_verify( "data-1m", [ "--http2" ] )
# POST some data using nghttp and see it echo'ed properly back # POST some data using nghttp and see it echo'ed properly back
def nghttp_post_and_verify(self, fname, options=None): def nghttp_post_and_verify(self, fname, options=None):
url = TestEnv.mkurl("https", "cgi", "/proxy/echo.py") url = TestEnv.mkurl("https", "cgi", "/proxy/echo.py")
fpath = os.path.join(TestEnv.GEN_DIR, fname) fpath = os.path.join(TestEnv.GEN_DIR, fname)
r = TestEnv.nghttp().upload(url, fpath, options=options) r = TestEnv.nghttp().upload(url, fpath, options=options)
assert r["rv"] == 0 assert r["rv"] == 0
assert r["response"]["status"] >= 200 and r["response"]["status"] < 300 assert 200 <= r["response"]["status"] < 300
with open(TestEnv.e2e_src( fpath ), mode='rb') as file: with open(TestEnv.e2e_src( fpath ), mode='rb') as file:
src = file.read() src = file.read()
#assert len(src) == len(r["response"]["body"]) #assert len(src) == len(r["response"]["body"])
assert src == r["response"]["body"] assert src == r["response"]["body"]
@pytest.mark.skipif(not TestEnv.has_nghttp(), reason="no nghttp command avai lable") @pytest.mark.skipif(not TestEnv.has_nghttp(), reason="no nghttp command avai lable")
def test_500_20(self): def test_500_20(self):
self.nghttp_post_and_verify( "data-1k", [ ] ) self.nghttp_post_and_verify( "data-1k", [ ] )
self.nghttp_post_and_verify( "data-10k", [ ] ) self.nghttp_post_and_verify( "data-10k", [ ] )
self.nghttp_post_and_verify( "data-100k", [ ] ) self.nghttp_post_and_verify( "data-100k", [ ] )
skipping to change at line 101 skipping to change at line 97
self.nghttp_post_and_verify( "data-100k", [ "--no-content-length" ] ) self.nghttp_post_and_verify( "data-100k", [ "--no-content-length" ] )
self.nghttp_post_and_verify( "data-1m", [ "--no-content-length" ] ) self.nghttp_post_and_verify( "data-1m", [ "--no-content-length" ] )
# upload and GET again using nghttp, compare to original content # upload and GET again using nghttp, compare to original content
def nghttp_upload_and_verify(self, fname, options=None): def nghttp_upload_and_verify(self, fname, options=None):
url = TestEnv.mkurl("https", "cgi", "/proxy/upload.py") url = TestEnv.mkurl("https", "cgi", "/proxy/upload.py")
fpath = os.path.join(TestEnv.GEN_DIR, fname) fpath = os.path.join(TestEnv.GEN_DIR, fname)
r = TestEnv.nghttp().upload_file(url, fpath, options=options) r = TestEnv.nghttp().upload_file(url, fpath, options=options)
assert r["rv"] == 0 assert r["rv"] == 0
assert r["response"]["status"] >= 200 and r["response"]["status"] < 300 assert 200 <= r["response"]["status"] < 300
assert r["response"]["header"]["location"] assert r["response"]["header"]["location"]
# why is the scheme wrong? # why is the scheme wrong?
r2 = TestEnv.nghttp().get(re.sub(r'http:', 'https:', r["response"]["head er"]["location"])) r2 = TestEnv.nghttp().get(re.sub(r'http:', 'https:', r["response"]["head er"]["location"]))
assert r2["rv"] == 0 assert r2["rv"] == 0
assert r2["response"]["status"] == 200 assert r2["response"]["status"] == 200
with open(TestEnv.e2e_src( fpath ), mode='rb') as file: with open(TestEnv.e2e_src( fpath ), mode='rb') as file:
src = file.read() src = file.read()
assert src == r2["response"]["body"] assert src == r2["response"]["body"]
skipping to change at line 133 skipping to change at line 129
self.nghttp_upload_and_verify( "data-100k", [ "--no-content-length" ] ) self.nghttp_upload_and_verify( "data-100k", [ "--no-content-length" ] )
self.nghttp_upload_and_verify( "data-1m", [ "--no-content-length" ] ) self.nghttp_upload_and_verify( "data-1m", [ "--no-content-length" ] )
# upload using nghttp and check returned status # upload using nghttp and check returned status
def nghttp_upload_stat(self, fname, options=None): def nghttp_upload_stat(self, fname, options=None):
url = TestEnv.mkurl("https", "cgi", "/proxy/upload.py") url = TestEnv.mkurl("https", "cgi", "/proxy/upload.py")
fpath = os.path.join(TestEnv.GEN_DIR, fname) fpath = os.path.join(TestEnv.GEN_DIR, fname)
r = TestEnv.nghttp().upload_file(url, fpath, options=options) r = TestEnv.nghttp().upload_file(url, fpath, options=options)
assert r["rv"] == 0 assert r["rv"] == 0
assert r["response"]["status"] >= 200 and r["response"]["status"] < 300 assert 200 <= r["response"]["status"] < 300
assert r["response"]["header"]["location"] assert r["response"]["header"]["location"]
@pytest.mark.skipif(not TestEnv.has_nghttp() or True, reason="no nghttp comm and available and python3 chokes on chunks") @pytest.mark.skipif(not TestEnv.has_nghttp() or True, reason="no nghttp comm and available and python3 chokes on chunks")
def test_500_24(self): def test_500_24(self):
for i in range(100): for i in range(100):
self.nghttp_upload_stat( "data-1k", [ "--no-content-length" ] ) self.nghttp_upload_stat( "data-1k", [ "--no-content-length" ] )
 End of changes. 7 change blocks. 
8 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)