def test_fcgi_keep_alive(name): input_f = 'proto_test_' + name + '.in' output_f = 'proto_test_' + name + '.out' inp = tofcgi.to_fcgi_request(load_file(input_f),tofcgi.TEST_KEEP_ALIVE) out = load_file(output_f) s=get_socket() res = tofcgi.from_fcgi_response(transfer_all(s,inp),tofcgi.TEST_KEEP_ALIVE) check('fcgi keep alive first ' + name,res,out) res = tofcgi.from_fcgi_response(transfer_all(s,inp),tofcgi.TEST_KEEP_ALIVE) check('fcgi keep alive second ' + name,res,out) if hasattr(socket,'SHUT_RDWR'): s.shutdown(socket.SHUT_RDWR) else: s.shutdown(2) s.close()
target = ('/tmp/cppcms_test_socket') socket_type = socket.AF_UNIX if test == 'http': input = load_file('disco_test_norm.in') test_io(input, socket_type, target) input = load_file('disco_test_gzip.in') test_io(input, socket_type, target) input = load_file('disco_test_async_multiple.in') test_io(input, socket_type, target) input = load_file('disco_test_async_single.in') test_io(input, socket_type, target) input = load_file('disco_test_async_nonblocking.in') test_io(input, socket_type, target) elif test == 'fastcgi_tcp' or test == 'fastcgi_unix': input = tofcgi.to_fcgi_request(load_file('disco_test_norm_cgi.in')) test_io(input, socket_type, target) input = tofcgi.to_fcgi_request(load_file('disco_test_gzip_cgi.in')) test_io(input, socket_type, target) input = tofcgi.to_fcgi_request( load_file('disco_test_async_cgi_multiple.in')) test_io(input, socket_type, target) input = tofcgi.to_fcgi_request(load_file('disco_test_async_cgi_single.in')) test_io(input, socket_type, target) input = tofcgi.to_fcgi_request( load_file('disco_test_async_cgi_nonblocking.in')) test_io(input, socket_type, target) elif test == 'scgi_tcp' or test == 'scgi_unix': input = toscgi.toscgi(load_file('disco_test_norm_cgi.in')) test_io(input, socket_type, target) input = toscgi.toscgi(load_file('disco_test_gzip_cgi.in'))
def load(name): file = load_file(name) return tofcgi.to_fcgi_request(file, flags)
socket_type = socket.AF_INET else: target = "/tmp/cppcms_test_socket" socket_type = socket.AF_UNIX if test == "http": input = load_file("disco_test_norm.in") test_io(input, socket_type, target) input = load_file("disco_test_gzip.in") test_io(input, socket_type, target) input = load_file("disco_test_async_multiple.in") test_io(input, socket_type, target) input = load_file("disco_test_async_single.in") test_io(input, socket_type, target) elif test == "fastcgi_tcp" or test == "fastcgi_unix": input = tofcgi.to_fcgi_request(load_file("disco_test_norm_cgi.in")) test_io(input, socket_type, target) input = tofcgi.to_fcgi_request(load_file("disco_test_gzip_cgi.in")) test_io(input, socket_type, target) input = tofcgi.to_fcgi_request(load_file("disco_test_async_cgi_multiple.in")) test_io(input, socket_type, target) input = tofcgi.to_fcgi_request(load_file("disco_test_async_cgi_single.in")) test_io(input, socket_type, target) elif test == "scgi_tcp" or test == "scgi_unix": input = toscgi.toscgi(load_file("disco_test_norm_cgi.in")) test_io(input, socket_type, target) input = toscgi.toscgi(load_file("disco_test_gzip_cgi.in")) test_io(input, socket_type, target) input = toscgi.toscgi(load_file("disco_test_async_cgi_multiple.in")) test_io(input, socket_type, target) input = toscgi.toscgi(load_file("disco_test_async_cgi_single.in"))
target=('/tmp/cppcms_test_socket') socket_type=socket.AF_UNIX if test=='http': input = load_file('disco_test_norm.in'); test_io(input,socket_type,target); input = load_file('disco_test_gzip.in'); test_io(input,socket_type,target); input = load_file('disco_test_async_multiple.in'); test_io(input,socket_type,target); input = load_file('disco_test_async_single.in'); test_io(input,socket_type,target); input = load_file('disco_test_async_nonblocking.in'); test_io(input,socket_type,target); elif test=='fastcgi_tcp' or test=='fastcgi_unix': input = tofcgi.to_fcgi_request(load_file('disco_test_norm_cgi.in')); test_io(input,socket_type,target); input = tofcgi.to_fcgi_request(load_file('disco_test_gzip_cgi.in')); test_io(input,socket_type,target); input = tofcgi.to_fcgi_request(load_file('disco_test_async_cgi_multiple.in')); test_io(input,socket_type,target); input = tofcgi.to_fcgi_request(load_file('disco_test_async_cgi_single.in')); test_io(input,socket_type,target); input = tofcgi.to_fcgi_request(load_file('disco_test_async_cgi_nonblocking.in')); test_io(input,socket_type,target); elif test=='scgi_tcp' or test=='scgi_unix': input = toscgi.toscgi(load_file('disco_test_norm_cgi.in')); test_io(input,socket_type,target); input = toscgi.toscgi(load_file('disco_test_gzip_cgi.in')); test_io(input,socket_type,target); input = toscgi.toscgi(load_file('disco_test_async_cgi_multiple.in'));
def load(name): file=load_file(name) return tofcgi.to_fcgi_request(file,flags)
def usege(): print './disco_test.py (http|fastcgi_tcp|scgi_tcp|fastcgi_unix|scgi_unix)' test=sys.argv[1] if test=='http' or test=='fastcgi_tcp' or test=='scgi_tcp': target=('localhost',8080) socket_type=socket.AF_INET else: target=('/tmp/cppcms_test_socket') socket_type=socket.AF_UNIX if test=='http': input = load_file('disco_test_norm.in'); test_io(input,socket_type,target); input = load_file('disco_test_gzip.in'); test_io(input,socket_type,target); elif test=='fastcgi_tcp' or test=='fastcgi_unix': input = tofcgi.to_fcgi_request(load_file('disco_test_norm_cgi.in')); test_io(input,socket_type,target); input = tofcgi.to_fcgi_request(load_file('disco_test_gzip_cgi.in')); test_io(input,socket_type,target); elif test=='scgi_tcp' or test=='scgi_unix': input = toscgi.toscgi(load_file('disco_test_norm_cgi.in')); test_io(input,socket_type,target); input = toscgi.toscgi(load_file('disco_test_gzip_cgi.in')); test_io(input,socket_type,target); else: usege()