I have a problem with the right receive POST:

python3, uwsgi 0.9.7

in html/js on chrome 10:

var xhr = new XMLHttpRequest;
var formData = new FormData();
formData.append("filename", file.fileName);
xhr.open("post", "/upload/", true);
xhr.send(formData);

And the data is sent. Chrome adds the headers correctly.
It receives in uWSGI:

{'CONTENT_LENGTH': '153',
 'CONTENT_TYPE': 'multipart/form-data; 
boundary=----WebKitFormBoundaryryYWB0YiAo4Ct3BF',
 'HTTP_ACCEPT': '*/*',
 'HTTP_ACCEPT_CHARSET': 'ISO-8859-2,utf-8;q=0.7,*;q=0.3',
 'HTTP_ACCEPT_ENCODING': 'gzip,deflate,sdch',
 'HTTP_ACCEPT_LANGUAGE': 'pl-PL,pl;q=0.8,en-US;q=0.6,en;q=0.4',
 'HTTP_CACHE_CONTROL': 'no-cache',
 'HTTP_CONNECTION': 'keep-alive',
 'HTTP_CONTENT_LENGTH': '153',
 'HTTP_CONTENT_TYPE': 'multipart/form-data; 
boundary=----WebKitFormBoundaryryYWB0YiAo4Ct3BF',
 'HTTP_HOST': 't3',
 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.16 
(KHTML, like Gecko) Chrome/10.0.648.151 Safari/534.16',
 'PATH_INFO': '/upload/',
 'QUERY_STRING': '',
 'REMOTE_ADDR': '127.0.1.1',
 'REMOTE_PORT': '47960',
 'REQUEST_METHOD': 'POST',
 'REQUEST_URI': '/upload/',
 'SERVER_NAME': 't3',
 'SERVER_PORT': '80',
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'UWSGI_SCRIPT': 'start',
 'uwsgi.version': b'0.9.7',
 'wsgi.errors': <_io.TextIOWrapper name=2 encoding='UTF-8'>,
 'wsgi.file_wrapper': <built-in function uwsgi_sendfile>,
 'wsgi.input': <_io.TextIOWrapper name=5 encoding='UTF-8'>,
 'wsgi.multiprocess': True,
 'wsgi.multithread': False,
 'wsgi.run_once': False,
 'wsgi.url_scheme': b'http',
 'wsgi.version': (1, 0)}

backend code:


pprint(self.environ)
try: length = int(self.environ.get('CONTENT_LENGTH', '0'))
except ValueError: length = 0

form = cgi.FieldStorage(
    fp=environ['wsgi.input'],
    environ=environ,
    keep_blank_values=1,
)
print(form['filename'])


On reading wsgi.input hangs like CONTENT_LENGTH was not correct.
It seems that waiting for data, but nothing comes.

When throw an exception timeout, it parses the data correctly.


after adding to ini:
post-buffering=4096


2011-27-03 21:02:37 - spawned uWSGI master process (pid: 8279)
2011-27-03 21:02:37 - spawned uWSGI worker 1 (pid: 8285, cores: 1)
2011-27-03 21:02:37 - spawned uWSGI worker 2 (pid: 8286, cores: 1)
2011-27-03 21:02:37 - spawned uWSGI worker 3 (pid: 8287, cores: 1)
2011-27-03 21:02:39 - DAMN ! worker 2 (pid: 8286) died :( trying respawn ...
2011-27-03 21:02:39 - Respawned uWSGI worker 2 (new pid: 8288)
2011-27-03 21:02:40 - DAMN ! worker 3 (pid: 8287) died :( trying respawn ...
2011-27-03 21:02:40 - Respawned uWSGI worker 3 (new pid: 8289)
2011-27-03 21:02:40 - DAMN ! worker 2 (pid: 8288) died :( trying respawn ...


-- 
Łukasz Wróblewski
http://www.nri.pl/ - Nowoczesne Rozwiązania Internetowe
http://www.hostowisko.pl/ - Profesjonalny i tani hosting
http://www.katalog-polskich-firm.pl/ - Najlepszy darmowy katalog firm
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to