Permalink
Browse files

import raw zope.server code

  • Loading branch information...
0 parents commit ca89e19909700b92fbd8fb9d099141b13a4b8862 @mcdonc mcdonc committed Dec 17, 2011
Showing with 8,206 additions and 0 deletions.
  1. +155 −0 CHANGES.txt
  2. +1 −0 COPYRIGHT.txt
  3. +44 −0 LICENSE.txt
  4. +19 −0 README.txt
  5. +50 −0 bootstrap.py
  6. +13 −0 buildout.cfg
  7. +76 −0 setup.py
  8. +1 −0 src/zope/__init__.py
  9. +25 −0 src/zope/server/__init__.py
  10. +77 −0 src/zope/server/adjustments.py
  11. +234 −0 src/zope/server/buffers.py
  12. +211 −0 src/zope/server/dualmodechannel.py
  13. +50 −0 src/zope/server/fixedstreamreceiver.py
  14. +11 −0 src/zope/server/ftp/README.txt
  15. +2 −0 src/zope/server/ftp/__init__.py
  16. +32 −0 src/zope/server/ftp/logger.py
  17. +147 −0 src/zope/server/ftp/publisher.py
  18. +957 −0 src/zope/server/ftp/server.py
  19. +1 −0 src/zope/server/ftp/tests/__init__.py
  20. +308 −0 src/zope/server/ftp/tests/demofs.py
  21. +154 −0 src/zope/server/ftp/tests/fstests.py
  22. +38 −0 src/zope/server/ftp/tests/test_demofs.py
  23. +392 −0 src/zope/server/ftp/tests/test_ftpserver.py
  24. +120 −0 src/zope/server/ftp/tests/test_publisher.py
  25. +2 −0 src/zope/server/http/__init__.py
  26. +106 −0 src/zope/server/http/chunking.py
  27. +94 −0 src/zope/server/http/commonaccesslogger.py
  28. +145 −0 src/zope/server/http/http_date.py
  29. +204 −0 src/zope/server/http/httprequestparser.py
  30. +53 −0 src/zope/server/http/httpserver.py
  31. +25 −0 src/zope/server/http/httpserverchannel.py
  32. +253 −0 src/zope/server/http/httptask.py
  33. +60 −0 src/zope/server/http/publisherhttpserver.py
  34. +2 −0 src/zope/server/http/tests/__init__.py
  35. +47 −0 src/zope/server/http/tests/test_commonaccesslogger.py
  36. +33 −0 src/zope/server/http/tests/test_httpdate.py
  37. +136 −0 src/zope/server/http/tests/test_httprequestparser.py
  38. +395 −0 src/zope/server/http/tests/test_httpserver.py
  39. +484 −0 src/zope/server/http/tests/test_wsgiserver.py
  40. +11 −0 src/zope/server/http/tests/wsgi_app.py
  41. +153 −0 src/zope/server/http/wsgihttpserver.py
  42. +298 −0 src/zope/server/interfaces/__init__.py
  43. +413 −0 src/zope/server/interfaces/ftp.py
  44. +34 −0 src/zope/server/interfaces/logger.py
  45. +2 −0 src/zope/server/linereceiver/__init__.py
  46. +68 −0 src/zope/server/linereceiver/linecommandparser.py
  47. +140 −0 src/zope/server/linereceiver/lineserverchannel.py
  48. +68 −0 src/zope/server/linereceiver/linetask.py
  49. +2 −0 src/zope/server/logger/__init__.py
  50. +69 −0 src/zope/server/logger/filelogger.py
  51. +177 −0 src/zope/server/logger/m_syslog.py
  52. +38 −0 src/zope/server/logger/pythonlogger.py
  53. +50 −0 src/zope/server/logger/resolvinglogger.py
  54. +91 −0 src/zope/server/logger/rotatingfilelogger.py
  55. +46 −0 src/zope/server/logger/socketlogger.py
  56. +58 −0 src/zope/server/logger/sysloglogger.py
  57. +40 −0 src/zope/server/logger/taillogger.py
  58. +2 −0 src/zope/server/logger/tests/__init__.py
  59. +66 −0 src/zope/server/logger/tests/test_pythonlogger.py
  60. +29 −0 src/zope/server/logger/unresolvinglogger.py
  61. +90 −0 src/zope/server/maxsockets.py
  62. +148 −0 src/zope/server/serverbase.py
  63. +231 −0 src/zope/server/serverchannelbase.py
  64. +124 −0 src/zope/server/taskthreads.py
  65. +2 −0 src/zope/server/tests/__init__.py
  66. +49 −0 src/zope/server/tests/asyncerror.py
  67. +98 −0 src/zope/server/tests/test_serverbase.py
  68. +151 −0 src/zope/server/tests/test_zombies.py
  69. +228 −0 src/zope/server/trigger.py
  70. +32 −0 src/zope/server/utilities.py
  71. +34 −0 src/zope/server/zlogintegration.py
  72. +7 −0 test.ini
@@ -0,0 +1,155 @@
+=======
+CHANGES
+=======
+
+3.8.6 (unreleased)
+------------------
+
+- Nothing changed yet.
+
+
+3.8.5 (2011-09-13)
+------------------
+
+- fixed bug: requests lasting over 15 minutes were sometimes closed
+ prematurely.
+
+3.8.4 (2011-06-07)
+------------------
+
+- Fix syntax error in tests on Python < 2.6.
+
+
+3.8.3 (2011-05-18)
+------------------
+
+- Made ``start_response`` method of WSGI server implementation more compliant
+ with spec:
+
+ http://www.python.org/dev/peps/pep-0333/#the-start-response-callable
+
+3.8.2 (2010-12-04)
+------------------
+
+- Corrected license version in ``zope/server/http/tests/test_wsgiserver.py``.
+
+3.8.1 (2010-08-24)
+------------------
+
+- When the result of a WSGI application was received, ``task.write()`` was
+ only called once to transmit the data. This prohibited the transmission of
+ partial results. Now the WSGI server iterates through the result itself
+ making multiple ``task.write()`` calls, which will cause partial data to be
+ transmitted.
+
+- Created a second test case instance for the post-mortem WSGI server, so it
+ is tested as well.
+
+- Using python's ``doctest`` module instead of deprecated
+ ``zope.testing.doctest``.
+
+3.8.0 (2010-08-05)
+------------------
+
+- Implemented correct server proxy behavior. The HTTP server would always add
+ a "Server" and "Date" response header to the list of response headers
+ regardless whether one had been set already. The HTTP 1.1 spec specifies
+ that a proxy server must not modify the "Server" and "Date" header but add a
+ "Via" header instead.
+
+3.7.0 (2010-08-01)
+------------------
+
+- Implemented proxy support. Proxy requests contain a full URIs and the
+ request parser used to throw that information away. Using
+ ``urlparse.urlsplit()``, all pieces of the URL are recorded.
+
+- The proxy acheme and netloc/hostname are exposed in the WSGI environment as
+ ``zserver.proxy.scheme`` and ``zserver.proxy.host``.
+
+- Made tests runnable via buildout again.
+
+3.6.2 (2010-06-11)
+------------------
+
+- The log message "Exception during task" is no longer logged to the root
+ logger but to zope.server.taskthreads.
+
+
+3.6.1 (2009-10-07)
+------------------
+
+- Made tests pass with current zope.publisher which restricts redirects to the
+ current host by default.
+
+
+3.6.0 (2009-05-27)
+------------------
+
+- Moved some imports from test modules to their setUp to prevent
+ failures when ZEO tests are run by the same testrunner
+
+- Removed unused dependency on zope.deprecation.
+
+- Remove old zpkg-related DEPENDENCIES.cfg file.
+
+
+3.5.0 (2008-03-01)
+------------------
+
+- Improve package meta-data.
+
+- Fix of 599 error on conflict error in request
+ see: http://mail.zope.org/pipermail/zope-dev/2008-January/030844.html
+
+- Removed dependency on ZODB.
+
+
+3.5.0a2 (2007-06-02)
+--------------------
+
+- Made WSGI server really WSGI-compliant by adding variables to the
+ environment that are required by the spec.
+
+
+3.5.0a1 (2007-06-02)
+--------------------
+
+- Added a factory and entry point for PasteDeploy.
+
+
+3.4.3 (2008-08-18)
+------------------
+
+- Moved some imports from test modules to their setUp to prevent
+ failures when ZEO tests are run by the same testrunner
+
+
+3.4.2 (2008-02-02)
+------------------
+
+- Fix of 599 error on conflict error in request
+ see: http://mail.zope.org/pipermail/zope-dev/2008-January/030844.html
+
+
+3.4.1 (2007-06-02)
+------------------
+
+- Made WSGI server really WSGI-compliant by adding variables to the
+ environment that are required by the spec.
+
+
+3.4.0 (2007-06-02)
+------------------
+
+- Removed an unused import. Unchanged otherwise.
+
+
+3.4.0a1 (2007-04-22)
+--------------------
+
+- Initial release as a separate project, corresponds to zope.server
+ from Zope 3.4.0a1
+
+- Made WSGI server really WSGI-compliant by adding variables to the
+ environment that are required by the spec.
@@ -0,0 +1 @@
+Zope Foundation and Contributors
@@ -0,0 +1,44 @@
+Zope Public License (ZPL) Version 2.1
+
+A copyright notice accompanies this license document that identifies the
+copyright holders.
+
+This license has been certified as open source. It has also been designated as
+GPL compatible by the Free Software Foundation (FSF).
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions in source code must retain the accompanying copyright
+notice, this list of conditions, and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the accompanying copyright
+notice, this list of conditions, and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+3. Names of the copyright holders must not be used to endorse or promote
+products derived from this software without prior written permission from the
+copyright holders.
+
+4. The right to distribute this software or to use it for any purpose does not
+give you the right to use Servicemarks (sm) or Trademarks (tm) of the
+copyright
+holders. Use of them is covered by separate agreement with the copyright
+holders.
+
+5. If any files are modified, you must cause the modified files to carry
+prominent notices stating that you changed the files and the date of any
+change.
+
+Disclaimer
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESSED
+OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,19 @@
+This package contains generic base classes for channel-based servers, the
+servers themselves and helper objects, such as tasks and requests.
+
+============
+WSGI Support
+============
+
+`zope.server`'s HTTP server comes with WSGI_ support.
+``zope.server.http.wsgihttpserver.WSGIHTTPServer`` can act as a WSGI gateway.
+There's also an entry point for PasteDeploy_ that lets you use zope.server's
+WSGI gateway from a configuration file, e.g.::
+
+ [server:main]
+ use = egg:zope.server
+ host = 127.0.0.1
+ port = 8080
+
+.. _WSGI: http://www.python.org/dev/peps/pep-0333/
+.. _PasteDeploy: http://pythonpaste.org/deploy/
@@ -0,0 +1,50 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Bootstrap a buildout-based project
+
+Simply run this script in a directory containing a buildout.cfg.
+The script accepts buildout command-line options, so you can
+use the -c option to specify an alternate configuration file.
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+ez = {}
+exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
+ ).read() in ez
+ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
+
+import pkg_resources
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+if sys.platform == 'win32':
+ cmd = '"%s"' % cmd # work around spawn lamosity on windows
+
+ws = pkg_resources.working_set
+assert os.spawnle(
+ os.P_WAIT, sys.executable, sys.executable,
+ '-c', cmd, '-mqNxd', tmpeggs, 'zc.buildout',
+ dict(os.environ,
+ PYTHONPATH=
+ ws.find(pkg_resources.Requirement.parse('setuptools')).location
+ ),
+ ) == 0
+
+ws.add_entry(tmpeggs)
+ws.require('zc.buildout')
+import zc.buildout.buildout
+zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
+shutil.rmtree(tmpeggs)
@@ -0,0 +1,13 @@
+[buildout]
+develop = .
+parts = test paste-test
+
+[paste-test]
+recipe = zc.recipe.egg
+eggs = zope.server
+ PasteDeploy
+ PasteScript
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = zope.server [test]
@@ -0,0 +1,76 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+# This package is developed by the Zope Toolkit project, documented here:
+# http://docs.zope.org/zopetoolkit
+# When developing and releasing this package, please follow the documented
+# Zope Toolkit policies as described by this documentation.
+##############################################################################
+"""Setup for zope.server package
+"""
+import os
+from setuptools import setup, find_packages
+
+def read(*rnames):
+ return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+
+
+tests_require = [
+ 'zope.testing',
+ 'zope.i18n',
+ 'zope.component',
+ ]
+
+
+setup(
+ name='zope.server',
+ version='3.8.6dev',
+ author='Zope Foundation and Contributors',
+ author_email='zope-dev@zope.org',
+ description='Zope Server (Web and FTP)',
+ long_description=(
+ read('README.txt')
+ + '\n\n' +
+ read('CHANGES.txt')
+ ),
+ license='ZPL 2.1',
+ keywords=('zope3 server http ftp'),
+ classifiers = [
+ 'Development Status :: 5 - Production/Stable',
+ 'Environment :: Web Environment',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: Zope Public License',
+ 'Programming Language :: Python',
+ 'Natural Language :: English',
+ 'Operating System :: OS Independent',
+ 'Topic :: Internet :: WWW/HTTP',
+ 'Framework :: Zope3'],
+ url='http://pypi.python.org/pypi/zope.server',
+ packages=find_packages('src'),
+ package_dir = {'': 'src'},
+ namespace_packages=['zope',],
+ tests_require=tests_require,
+ install_requires=[
+ 'setuptools',
+ 'zope.interface',
+ 'zope.publisher',
+ 'zope.security',
+ ],
+ extras_require=dict(test=tests_require),
+ include_package_data=True,
+ zip_safe=False,
+ entry_points="""
+ [paste.server_runner]
+ main = zope.server.http.wsgihttpserver:run_paste
+ """
+ )
@@ -0,0 +1 @@
+__import__('pkg_resources').declare_namespace(__name__)
@@ -0,0 +1,25 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Zope 3's Servers
+
+This package contains generic base classes for channel-based servers, the
+servers themselves and helper objects, such as tasks and requests.
+"""
+import asyncore
+
+from zope.server.interfaces import IDispatcher
+from zope.interface import classImplements
+
+# Tell the the async.dispatcher that it implements IDispatcher.
+classImplements(asyncore.dispatcher, IDispatcher)
Oops, something went wrong.

0 comments on commit ca89e19

Please sign in to comment.