Commit 0bd4df83 authored by Hanno Schlichting's avatar Hanno Schlichting

Avoid ZServer depending on App.

parent b33bf1df
......@@ -43,7 +43,6 @@ from cStringIO import StringIO
from PubCore import handle
from HTTPResponse import make_response
from ZPublisher.HTTPRequest import HTTPRequest
from App.config import getConfiguration
import asyncore
import asynchat
......@@ -76,6 +75,17 @@ header2env={'content-length' : 'CONTENT_LENGTH',
}
def get_http_header_max_length():
max_length = 8192
try:
from App.config import getConfiguration
except ImportError:
pass
else:
max_length = getConfiguration().http_header_max_length
return max_length
class zhttp_collector:
def __init__(self, handler, request, size):
from ZServer import LARGE_FILE_THRESHOLD
......@@ -352,7 +362,7 @@ class zhttp_channel(http_channel):
requestCloseOnExec(conn)
self.queue = []
self.working=0
self.max_header_len = getConfiguration().http_header_max_length
self.max_header_len = get_http_header_max_length()
def push(self, producer, send=1):
# this is thread-safe when send is false
......
......@@ -13,10 +13,26 @@
""" A set of utility routines used by asyncore initialization """
import sys
import pkg_resources
_version_string = None
def _prep_version_data():
global _version_string
if _version_string is None:
v = sys.version_info
pyver = "python %d.%d.%d, %s" % (v[0], v[1], v[2], sys.platform)
dist = pkg_resources.get_distribution('Zope2')
_version_string = "%s, %s" % (dist.version, pyver)
def getZopeVersion():
import App.version_txt
return App.version_txt.version_txt()
_prep_version_data()
return '(%s)' % _version_string
def patchAsyncoreLogger():
# Poke the Python logging module into asyncore to send messages to logging
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment