Lines Matching +full:proxy +full:- +full:from +full:- +full:env
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
23 # SPDX-License-Identifier: curl
33 from configparser import ConfigParser, ExtendedInterpolation
34 from datetime import timedelta
35 from typing import Optional
39 from .certs import CertificateSpec, TestCA, Credentials
40 from .ports import alloc_ports
83 p = subprocess.run(args=[self.curl, '-V'],
86 assert False, f'{self.curl} -V failed with exit code: {p.returncode}'
116 'proxy': socket.SOCK_STREAM,
140 self.proxy_domain = f"proxy.{self.tld}"
157 p = subprocess.run(args=[self.nghttpx, '-v'],
165 log.debug(f'nghttpx -v: {p.stdout}')
182 raise f'Unable to determine cadd version from: {p.stdout}'
190 p = subprocess.run(args=[self.vsftpd, '-v'],
199 # vsftp does not use stdout or stderr for printing its version... -.-
202 raise Exception(f'Unable to determine VsFTPD version from: {p.stderr}')
210 p = subprocess.run(args=[self.apxs, '-q', 'HTTPD_VERSION'],
221 v = re.sub(r'(\d+\.\d+(\.\d+)?)(-\S+)?', r'\1', v)
236 def is_complete(self) -> bool:
242 def get_incomplete_reason(self) -> Optional[str]:
244 return f'httpd not configured, see `--with-test-httpd=<path>`'
250 return f"command apxs not found (commonly provided in apache2-dev)"
268 class Env: class
273 def setup_incomplete() -> bool:
274 return not Env.CONFIG.is_complete()
277 def incomplete_reason() -> Optional[str]:
278 return Env.CONFIG.get_incomplete_reason()
281 def have_nghttpx() -> bool:
282 return Env.CONFIG.nghttpx is not None
285 def have_h3_server() -> bool:
286 return Env.CONFIG.nghttpx_with_h3
289 def have_ssl_curl() -> bool:
290 return 'ssl' in Env.CONFIG.curl_props['features']
293 def have_h2_curl() -> bool:
294 return 'http2' in Env.CONFIG.curl_props['features']
297 def have_h3_curl() -> bool:
298 return 'http3' in Env.CONFIG.curl_props['features']
301 def curl_uses_lib(libname: str) -> bool:
302 return libname.lower() in Env.CONFIG.curl_props['libs']
305 def curl_uses_ossl_quic() -> bool:
306 if Env.have_h3_curl():
307 return not Env.curl_uses_lib('ngtcp2') and Env.curl_uses_lib('nghttp3')
311 def curl_has_feature(feature: str) -> bool:
312 return feature.lower() in Env.CONFIG.curl_props['features']
315 def curl_has_protocol(protocol: str) -> bool:
316 return protocol.lower() in Env.CONFIG.curl_props['protocols']
319 def curl_lib_version(libname: str) -> str:
321 for lversion in Env.CONFIG.curl_props['lib_versions']:
327 def curl_lib_version_at_least(libname: str, min_version) -> str:
328 lversion = Env.curl_lib_version(libname)
330 return Env.CONFIG.versiontuple(min_version) <= \
331 Env.CONFIG.versiontuple(lversion)
335 def curl_os() -> str:
336 return Env.CONFIG.curl_props['os']
339 def curl_fullname() -> str:
340 return Env.CONFIG.curl_props['fullname']
343 def curl_version() -> str:
344 return Env.CONFIG.curl_props['version']
347 def curl_is_debug() -> bool:
348 return Env.CONFIG.curl_is_debug
351 def have_h3() -> bool:
352 return Env.have_h3_curl() and Env.have_h3_server()
355 def httpd_version() -> str:
356 return Env.CONFIG.httpd_version
359 def nghttpx_version() -> str:
360 return Env.CONFIG.nghttpx_version
363 def caddy_version() -> str:
364 return Env.CONFIG.caddy_version
367 def caddy_is_at_least(minv) -> bool:
368 return Env.CONFIG.caddy_is_at_least(minv)
371 def httpd_is_at_least(minv) -> bool:
372 return Env.CONFIG.httpd_is_at_least(minv)
375 def has_caddy() -> bool:
376 return Env.CONFIG.caddy is not None
379 def has_vsftpd() -> bool:
380 return Env.CONFIG.vsftpd is not None
383 def vsftpd_version() -> str:
384 return Env.CONFIG.vsftpd_version
405 def get_credentials(self, domain) -> Optional[Credentials]:
412 def verbose(self) -> int:
416 def test_timeout(self) -> Optional[float]:
424 def gen_dir(self) -> str:
428 def project_dir(self) -> str:
436 def htdocs_dir(self) -> str:
440 def domain1(self) -> str:
444 def domain1brotli(self) -> str:
448 def domain2(self) -> str:
452 def ftp_domain(self) -> str:
456 def proxy_domain(self) -> str:
460 def http_port(self) -> int:
464 def https_port(self) -> int:
468 def h3_port(self) -> int:
472 def proxy_port(self) -> int:
473 return self.CONFIG.ports['proxy']
476 def proxys_port(self) -> int:
480 def ftp_port(self) -> int:
484 def ftps_port(self) -> int:
488 def h2proxys_port(self) -> int:
491 def pts_port(self, proto: str = 'http/1.1') -> int:
492 # proxy tunnel port
496 def caddy(self) -> str:
500 def caddy_https_port(self) -> int:
504 def caddy_http_port(self) -> int:
508 def vsftpd(self) -> str:
512 def ws_port(self) -> int:
516 def curl(self) -> str:
520 def httpd(self) -> str:
524 def apachectl(self) -> str:
528 def apxs(self) -> str:
532 def nghttpx(self) -> Optional[str]:
536 def slow_network(self) -> bool:
541 def ci_run(self) -> bool:
552 def make_data_file(self, indir: str, fname: str, fsize: int) -> str:
558 fd.write(f"{i:09d}-{s}\n")
562 s = f"{i:09d}-{s}\n"