Handling chunked encoded HTTP POST requests in python (or common CGI under apache)

I have a j2me client that will send some encoded encoded data to a web server. I would like to process data in python. the script is executed as CGI, but obviously apache will refuse the requested write request to the CGI script. As far as I can see mod_python, WSGI and FastCGI do not go either.

I would like to know if there is a way for a python script to handle this type of input. I am open to any suggestion (e.g. setting up confoguration in apache2, which was collecting pieces, a stand-alone python server that would do the same, etc.). I did quite a lot of search queries and did not find anything useful, which is rather strange.

I know that accessing java on the server side would be a solution, but I just can't imagine that this cannot be solved using apache + python.

+5
source share
5 answers

I had the same problem a year ago when a J2ME client was talking to a Python / Ruby backend. The only solution I found that did not require changes in the application or infrastructure level was to use the relatively unknown mod_proxy function.

Mod_proxy () , Content-Length, -. , , Apache. .. 80, " ", , HTTP 1.1, 81.

. :

ProxyRequests Off

<Proxy http://example.com:81>
  Order deny,allow
  Allow from all
</Proxy>

<VirtualHost *:80>
  SetEnv proxy-sendcl 1
  ProxyPass / http://example.com:81/
  ProxyPassReverse / http://example.com:81/
  ProxyPreserveHost On
  ProxyVia Full

  <Directory proxy:*>
    Order deny,allow
    Allow from all
  </Directory>

</VirtualHost>

Listen 81

<VirtualHost *:81>
  ServerName example.com
  # Your Python application configuration goes here
</VirtualHost>

, .

+6

Apache 2.2 mod_cgi , Apache , CGI.

WSGI , mod_wsgi 411. WSGI 2.0. -, , !

+2

, , mod_python. mod_wsgi, 3.0. , WSGI 1.0, WSGI .

WSGIChunkedRequest http://code.google.com/p/modwsgi/wiki/ChangesInVersion0300 , .

+2

, ? Django Apache mod_python, WSGI FastCGI, .

+1