Impossible to configure HTTP server
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
web.py |
Fix Released
|
Undecided
|
Anand Chitipothu |
Bug Description
I posted to the g00gle group (http://
We really need to get access to the HTTP server prior to entering its listen/serve request loop, so we can customize and configure stuff (e.g. socket timeout). The attached patch (for web.py 0.32) provides an add_servercallb
##### snip #####
class test:
def GET(self, name):
return name
def configure_
urls = ("/(.*)", "test")
app = application(urls, globals())
app.
# now, the configure_webserver function will be called whenever an HTTP server is instantiated, before it is started.
##### snip #####
Feel free to re-organize/rename anything, or ask me to do so, to merge this into the project.
Thanks and regards,
Pat Deegan
Changed in webpy: | |
status: | Fix Committed → Fix Released |
the configure_webserver function works only for CherryPyWSIServer and not for other types of server. In fact it is not possible to write a function to configure any kind of server.
Here is the work-around: (you need latest web.py code for this)
import web
def create_server(*a, **kw): CherryPyServer( *a, **kw)
server = web.wsgiserver.
server.timeout = 666
return server
web.httpserver. CherryPyServer = create_server