[Welcome] [TitleIndex] [WordIndex

When your Quixote application is integrated with the Medusa HTTP server, it may be useful to be able to ignore certain requests that are clearly irrelevant to your application or that represent attempts to compromise the security of your server. Here is one method of "swallowing" requests that seems to work. Undesired requests are simply deleted before they are processed.

In your QuixoteHandler class, insert a new method:

  def reject_request(self, request):
    # (Code for logging the particulars of the request not shown)
    request['Connection'] = 'close'
    request.channel.current_request = None

At the beginning of QuixoteHandler.continue_request(), insert the following:

    if not request.uri.startswith(MYAPP_URI_ROOT):

Obviously, you are free to define your own conditions under which reject_request() gets called.


2010-09-22 22:14