MCPcopy Create free account
hub / github.com/apache/httpd / start_vhost

Method start_vhost

test/pyhttpd/conf.py:147–177  ·  view source on GitHub ↗
(self, domains, port=None, doc_root="htdocs", with_ssl=None,
                    ssl_module=None, with_certificates=None)

Source from the content-addressed store, hash-verified

145 return self
146
147 def start_vhost(self, domains, port=None, doc_root="htdocs", with_ssl=None,
148 ssl_module=None, with_certificates=None):
149 if not isinstance(domains, list):
150 domains = [domains]
151 if port is None:
152 port = self.env.https_port
153 if ssl_module is None:
154 ssl_module = self.env.ssl_module
155 if with_ssl is None:
156 with_ssl = self.env.https_port == port
157 if with_ssl and ssl_module == 'mod_tls' and port not in self._tls_engine_ports:
158 self.add(f"TLSEngine {port}")
159 self._tls_engine_ports.add(port)
160 self.add("")
161 self.add(f"<VirtualHost *:{port}>")
162 self._indents += 1
163 self.add(f"ServerName {domains[0]}")
164 for alias in domains[1:]:
165 self.add(f"ServerAlias {alias}")
166 self.add(f"DocumentRoot {doc_root}")
167 if with_ssl:
168 if ssl_module == 'mod_ssl':
169 self.add("SSLEngine on")
170 elif ssl_module == 'mod_gnutls':
171 self.add("GnuTLSEnable on")
172 if with_certificates is not False:
173 for cred in self.env.get_credentials_for_name(domains[0]):
174 self.add_certificate(cred.cert_file, cred.pkey_file, ssl_module=ssl_module)
175 if domains[0] in self._extras:
176 self.add(self._extras[domains[0]])
177 return self
178
179 def end_vhost(self):
180 self._indents -= 1

Callers 7

_class_scopeMethod · 0.95
_class_scopeMethod · 0.95
test_proxy_01_003Method · 0.95
add_vhostMethod · 0.95
add_vhost_test1Method · 0.95
add_vhost_test2Method · 0.95
add_vhost_cgiMethod · 0.95

Calls 3

addMethod · 0.95
add_certificateMethod · 0.95

Tested by 3

_class_scopeMethod · 0.76
_class_scopeMethod · 0.76
test_proxy_01_003Method · 0.76