Lines Matching refs:self

60     def __init__(self):  argument
61 self.tests_dir = TESTS_HTTPD_PATH
62 self.gen_dir = os.path.join(self.tests_dir, 'gen')
63 self.project_dir = os.path.dirname(os.path.dirname(self.tests_dir))
64 self.build_dir = TOP_PATH
65 self.config = DEF_CONFIG
67 self.curl = CURL
69 self.curl = os.environ['CURL']
70 self.curl_props = {
82 self.curl_is_debug = False
83 self.curl_protos = []
84 p = subprocess.run(args=[self.curl, '-V'],
89 self.curl_is_debug = True
92 self.curl_props['version_string'] = line
95 self.curl_props['fullname'] = m.group(0)
96 self.curl_props['version'] = m.group('version')
97 self.curl_props['os'] = m.group('os')
98 self.curl_props['lib_versions'] = {
101 self.curl_props['libs'] = {
102 re.sub(r'/[a-z0-9.-]*', '', lib) for lib in self.curl_props['lib_versions']
105 self.curl_props['features_string'] = line[10:]
106 self.curl_props['features'] = {
110 self.curl_props['protocols_string'] = line[11:]
111 self.curl_props['protocols'] = {
115 self.ports = alloc_ports(port_specs={
128 self.httpd = self.config['httpd']['httpd']
129 self.apachectl = self.config['httpd']['apachectl']
130 self.apxs = self.config['httpd']['apxs']
131 if len(self.apxs) == 0:
132 self.apxs = None
133 self._httpd_version = None
135 self.examples_pem = {
139 self.htdocs_dir = os.path.join(self.gen_dir, 'htdocs')
140 self.tld = 'http.curl.se'
141 self.domain1 = f"one.{self.tld}"
142 self.domain1brotli = f"brotli.one.{self.tld}"
143 self.domain2 = f"two.{self.tld}"
144 self.ftp_domain = f"ftp.{self.tld}"
145 self.proxy_domain = f"proxy.{self.tld}"
146 self.cert_specs = [
147 …CertificateSpec(domains=[self.domain1, self.domain1brotli, 'localhost', '127.0.0.1'], key_type='rs…
148 CertificateSpec(domains=[self.domain2], key_type='rsa2048'),
149 CertificateSpec(domains=[self.ftp_domain], key_type='rsa2048'),
150 CertificateSpec(domains=[self.proxy_domain, '127.0.0.1'], key_type='rsa2048'),
156 self.nghttpx = self.config['nghttpx']['nghttpx']
157 if len(self.nghttpx.strip()) == 0:
158 self.nghttpx = None
159 self._nghttpx_version = None
160 self.nghttpx_with_h3 = False
161 if self.nghttpx is not None:
162 p = subprocess.run(args=[self.nghttpx, '-v'],
166 self.nghttpx = None
168 self._nghttpx_version = re.sub(r'^nghttpx\s*', '', p.stdout.strip())
169 self.nghttpx_with_h3 = re.match(r'.* nghttp3/.*', p.stdout.strip()) is not None
172 self.caddy = self.config['caddy']['caddy']
173 self._caddy_version = None
174 if len(self.caddy.strip()) == 0:
175 self.caddy = None
176 if self.caddy is not None:
178 p = subprocess.run(args=[self.caddy, 'version'],
182 self.caddy = None
185 self._caddy_version = m.group(1)
190 self.caddy = None
192 self.vsftpd = self.config['vsftpd']['vsftpd']
193 self._vsftpd_version = None
194 if self.vsftpd is not None:
197 p = subprocess.run(args=[self.vsftpd, '-v'],
201 self.vsftpd = None
213 self._vsftpd_version = m.group(1)
216 self._vsftpd_version = 'unknown'
220 self.vsftpd = None
222 self._tcpdump = shutil.which('tcpdump')
225 def httpd_version(self): argument
226 if self._httpd_version is None and self.apxs is not None:
228 p = subprocess.run(args=[self.apxs, '-q', 'HTTPD_VERSION'],
233 self._httpd_version = p.stdout.strip()
236 return self._httpd_version
238 def versiontuple(self, v): argument
242 def httpd_is_at_least(self, minv): argument
243 if self.httpd_version is None:
245 hv = self.versiontuple(self.httpd_version)
246 return hv >= self.versiontuple(minv)
248 def caddy_is_at_least(self, minv): argument
249 if self.caddy_version is None:
251 hv = self.versiontuple(self.caddy_version)
252 return hv >= self.versiontuple(minv)
254 def is_complete(self) -> bool: argument
255 return os.path.isfile(self.httpd) and \
256 os.path.isfile(self.apachectl) and \
257 self.apxs is not None and \
258 os.path.isfile(self.apxs)
260 def get_incomplete_reason(self) -> Optional[str]: argument
261 if self.httpd is None or len(self.httpd.strip()) == 0:
263 if not os.path.isfile(self.httpd):
265 if not os.path.isfile(self.apachectl):
267 if self.apxs is None:
269 if not os.path.isfile(self.apxs):
274 def nghttpx_version(self): argument
275 return self._nghttpx_version
278 def caddy_version(self): argument
279 return self._caddy_version
282 def vsftpd_version(self): argument
283 return self._vsftpd_version
286 def tcpdmp(self) -> Optional[str]: argument
287 return self._tcpdump
424 def __init__(self, pytestconfig=None): argument
425 self._verbose = pytestconfig.option.verbose \
427 self._ca = None
428 self._test_timeout = 300.0 if self._verbose > 1 else 60.0 # seconds
430 def issue_certs(self): argument
431 if self._ca is None:
432 ca_dir = os.path.join(self.CONFIG.gen_dir, 'ca')
433 self._ca = TestCA.create_root(name=self.CONFIG.tld,
436 self._ca.issue_certs(self.CONFIG.cert_specs)
438 def setup(self): argument
439 os.makedirs(self.gen_dir, exist_ok=True)
440 os.makedirs(self.htdocs_dir, exist_ok=True)
441 self.issue_certs()
443 def get_credentials(self, domain) -> Optional[Credentials]: argument
444 creds = self.ca.get_credentials_for_name(domain)
450 def verbose(self) -> int: argument
451 return self._verbose
454 def test_timeout(self) -> Optional[float]: argument
455 return self._test_timeout
458 def test_timeout(self, val: Optional[float]): argument
459 self._test_timeout = val
462 def gen_dir(self) -> str: argument
463 return self.CONFIG.gen_dir
466 def project_dir(self) -> str: argument
467 return self.CONFIG.project_dir
470 def build_dir(self) -> str: argument
471 return self.CONFIG.build_dir
474 def ca(self): argument
475 return self._ca
478 def htdocs_dir(self) -> str: argument
479 return self.CONFIG.htdocs_dir
482 def tld(self) -> str: argument
483 return self.CONFIG.tld
486 def domain1(self) -> str: argument
487 return self.CONFIG.domain1
490 def domain1brotli(self) -> str: argument
491 return self.CONFIG.domain1brotli
494 def domain2(self) -> str: argument
495 return self.CONFIG.domain2
498 def ftp_domain(self) -> str: argument
499 return self.CONFIG.ftp_domain
502 def proxy_domain(self) -> str: argument
503 return self.CONFIG.proxy_domain
506 def http_port(self) -> int: argument
507 return self.CONFIG.ports['http']
510 def https_port(self) -> int: argument
511 return self.CONFIG.ports['https']
514 def nghttpx_https_port(self) -> int: argument
515 return self.CONFIG.ports['nghttpx_https']
518 def h3_port(self) -> int: argument
519 return self.https_port
522 def proxy_port(self) -> int: argument
523 return self.CONFIG.ports['proxy']
526 def proxys_port(self) -> int: argument
527 return self.CONFIG.ports['proxys']
530 def ftp_port(self) -> int: argument
531 return self.CONFIG.ports['ftp']
534 def ftps_port(self) -> int: argument
535 return self.CONFIG.ports['ftps']
538 def h2proxys_port(self) -> int: argument
539 return self.CONFIG.ports['h2proxys']
541 def pts_port(self, proto: str = 'http/1.1') -> int: argument
543 return self.CONFIG.ports['h2proxys' if proto == 'h2' else 'proxys']
546 def caddy(self) -> str: argument
547 return self.CONFIG.caddy
550 def caddy_https_port(self) -> int: argument
551 return self.CONFIG.ports['caddys']
554 def caddy_http_port(self) -> int: argument
555 return self.CONFIG.ports['caddy']
558 def vsftpd(self) -> str: argument
559 return self.CONFIG.vsftpd
562 def ws_port(self) -> int: argument
563 return self.CONFIG.ports['ws']
566 def curl(self) -> str: argument
567 return self.CONFIG.curl
570 def httpd(self) -> str: argument
571 return self.CONFIG.httpd
574 def apachectl(self) -> str: argument
575 return self.CONFIG.apachectl
578 def apxs(self) -> str: argument
579 return self.CONFIG.apxs
582 def nghttpx(self) -> Optional[str]: argument
583 return self.CONFIG.nghttpx
586 def slow_network(self) -> bool: argument
591 def ci_run(self) -> bool: argument
594 def port_for(self, alpn_proto: Optional[str] = None): argument
597 return self.https_port
599 return self.h3_port
600 return self.http_port
602 def authority_for(self, domain: str, alpn_proto: Optional[str] = None): argument
605 def make_data_file(self, indir: str, fname: str, fsize: int, argument