indyone
indyone at gmail.com
Wed Apr 11 05:08:28 EDT 2007
Hi all, I am trying to create a custom input filter and i'm facing some strange problems... I am running: Apache/2.0.59 (Win32) mod_python/3.3.1 Python/2.4.3 I have this testing filter.py: from mod_python import apache def inputfilter(filter): apache.log_error('MyFilter: Requested %s' % filter.req.uri, apache.APLOG_NOTICE) filter.pass_on() apache.log_error('MyFilter: Exiting...', apache.APLOG_NOTICE) The apache's conf has these: LoadModule rewrite_module modules/mod_rewrite.so LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule python_module modules/mod_python.so PythonAutoReload On PythonDebug On PythonInputFilter filter MY_INPUT SetInputFilter MY_INPUT RewriteEngine On RewriteRule ^/(.*) http://localhost:8080/VirtualHostBase/http/localhost:80/Plone/VirtualHostRoot/$1 [L,P] My problem is that when i'm calling the URL http://localhost the browser says 'Waiting for localhost' forever, Apache is eating memory & CPU really fast, and in the error log i get these also forever... [Wed Apr 11 11:15:18 2007] [notice] MyFilter: Requested / [Wed Apr 11 11:15:18 2007] [notice] MyFilter: Exiting... [Wed Apr 11 11:15:18 2007] [notice] MyFilter: Requested / [Wed Apr 11 11:15:18 2007] [notice] MyFilter: Exiting... [Wed Apr 11 11:15:18 2007] [notice] MyFilter: Requested / [Wed Apr 11 11:15:18 2007] [notice] MyFilter: Exiting... [Wed Apr 11 11:15:18 2007] [notice] MyFilter: Requested / [Wed Apr 11 11:15:18 2007] [notice] MyFilter: Exiting... .... Only way to stop this is killing apache. If i comment-out the rewrite from the .conf and call http://localhost i get the default index.html and the filter works fine. If i add a filter.close() like this (with the rewrite on again): def inputfilter(filter): apache.log_error('MyFilter: Requested %s' % filter.req.uri, apache.APLOG_NOTICE) filter.pass_on() filter.close() apache.log_error('MyFilter: Exiting...', apache.APLOG_NOTICE) The filter works fine in GET requests and i see properly the pages from the backend server (which is a Zope)... but... when i POST a form i get this in the error_log: [Wed Apr 11 11:55:12 2007] [notice] MyFilter: Requested /login_form [Wed Apr 11 11:55:12 2007] [notice] MyFilter: Exiting... [Wed Apr 11 12:00:12 2007] [error] [client 127.0.0.1] proxy: error reading status line from remote server localhost, referer: http://localhost/login_form [Wed Apr 11 12:00:12 2007] [error] [client 127.0.0.1] proxy: Error reading from remote server returned by /login_form, referer: http://localhost/login_form [Wed Apr 11 12:00:12 2007] [notice] MyFilter: Requested /login_form [Wed Apr 11 12:00:12 2007] [notice] MyFilter: Exiting... [Wed Apr 11 12:00:12 2007] [notice] MyFilter: Requested /login_form [Wed Apr 11 12:00:12 2007] [notice] MyFilter: Exiting... and yes, the backend server is still running... I have also tried this code with the combinations: Apache/2.2 (Win32) mod_python/3.3.1 Python/2.4.3 Apache/2.2 (Win32) mod_python/3.2.1 Python/2.4.3 and got the same results... Please give any hint u come up... Thank u in advance. Ioannis Stavrinos
|