[Zope] Zope-2.7 both http and https in parallel? (l-zope:
addressed to exclusive sender for this address)
Stefan Bund
l-zope.z.xalan at xoxy.net
Thu May 6 12:07:18 EDT 2004
Sascha Ottolski <sascha.ottolski at gallileus.de> writes:
> Now the missing piece is, to add the "HTTPS ON" Header only for request
> to port 443.
exactly. Thats why I wrote a patch. It adds a <https-server> stanza
identical to <http-server> but adding the HTTPS ON header
automatically.
I think, it would be better to allow multiple <http-server> stanzas
with embedded <cgi-environment> like:
<http-server>
address 443
<cgi-environment>
HTTPS ON
</cgi-environment>
</http-sever>
(THIS DOES NOT WORK NOW AS OF 2004-05-06 ITS A SUGGESTION !!!) but my
solution was much simpler to implement. The patch is not large, so I
think, it's ok to post it here, as others might well be interested as
well. This is against Zope-2.7.0.
--- /root/build/Zope-2.7.0/lib/python/ZServer/datatypes.py 2004-04-07 00:54:43.000000000 +0200
+++ lib/python/ZServer/datatypes.py 2004-04-07 13:36:19.000000000 +0200
@@ -74,6 +74,34 @@
from ZServer import HTTPServer
return HTTPServer.zhttp_handler(self.module, '', self.cgienv)
+class HTTPSServerFactory(ServerFactory):
+ def __init__(self, section):
+ ServerFactory.__init__(self, section.address)
+ self.force_connection_close = section.force_connection_close
+ # webdav-source-server sections won't have webdav_source_clients:
+ webdav_clients = getattr(section, "webdav_source_clients", None)
+ self.webdav_source_clients = webdav_clients
+
+ def create(self):
+ from ZServer import HTTPServer
+ from ZServer.AccessLogger import access_logger
+ handler = self.createHandler()
+ handler._force_connection_close = self.force_connection_close
+ if self.webdav_source_clients:
+ handler.set_webdav_source_clients(self.webdav_source_clients)
+ server = HTTPServer.zhttp_server(ip=self.host, port=self.port,
+ resolver=self.dnsresolver,
+ logger_object=access_logger)
+ server.install_handler(handler)
+ return server
+
+ def createHandler(self):
+ from ZServer import HTTPServer
+ cgienv = {}
+ cgienv.update(self.cgienv)
+ cgienv['HTTPS'] = 'ON'
+ return HTTPServer.zhttp_handler(self.module, '', cgienv)
+
class WebDAVSourceServerFactory(HTTPServerFactory):
def createHandler(self):
--- /root/build/Zope-2.7.0/lib/python/ZServer/component.xml 2003-03-24 23:32:39.000000000 +0100
+++ lib/python/ZServer/component.xml 2004-04-07 13:34:38.000000000 +0200
@@ -21,6 +21,19 @@
</key>
</sectiontype>
+ <sectiontype name="https-server"
+ datatype=".HTTPSServerFactory"
+ implements="ZServer.server">
+ <key name="address" datatype="inet-address"/>
+ <key name="force-connection-close" datatype="boolean" default="off"/>
+ <key name="webdav-source-clients">
+ <description>
+ Regular expression used to identify clients who should
+ receive WebDAV source responses to GET requests.
+ </description>
+ </key>
+ </sectiontype>
+
<sectiontype name="webdav-source-server"
datatype=".WebDAVSourceServerFactory"
implements="ZServer.server">
--
-- *DON'T* TRY TO REACH ME DIRECTLY AT ABOVE EMAIL ADDRESS. Any reply
-- received off-list at that address will be *silently* and
-- *unconditionally* dropped. You can attribute this inconvenience to
-- the proliferation of spammers on the Internet. I hope, you can
-- understand my position and accept my counter measures.
More information about the Zope
mailing list