Il giorno 07/apr/2011, alle ore 12.01, Pavel Kolla ha scritto:

> Roberto De Ioris <roberto@...> writes:
>> 
> data = '{"lastname":"кин"}'
> 
> urldata = urllib.parse.quote(data)
> env = dict()
> env['wsgi.input'] = StringIO(urldata)
> env['CONTENT_LENGTH'] = str(len(urldata))
> env['CONTENT_TYPE'] = 'multipart/form-data; boundary=--boundary'
> env['REQUEST_URI'] = '/query/' + request + '/'
> env['REQUEST_METHOD'] = 'POST'
> print(query.query_handler(env, output))
> 
> where query.query_handler is the module which is callable for uWSGI, i get 
> following in the log (as expected):
> 
> 2011-04-06 16:32:29,157 DEBUG    [austlog setup L:151] - Logger initialized
> 2011-04-06 16:32:29,460 ERROR    [errors handle L:80] - An error of type 
> error_query_execution has occurred, state: ['ListPersonsByLastnameLike', 
> {'lastname': 'кин'}], stack: [('wsgi_wrapper_query.py', 30, '<module>', 'print
> (query.query_handler(env, output))'), ('/var/www/devenv/pkolla/query.py', 10, 
> 'query_handler', 'return lib.web.web_entry(handler, "query", environ, 
> start_response)'), ('/var/www/devenv/pkolla/lib/web.py', 82, 'web_entry', 
> 'return str.encode(web_handler(handler, runtime_environ, signature, data))'), 
> ('/var/www/devenv/pkolla/lib/web.py', 57, 'web_handler', 'dto = 
> handler.process
> (params)'), ('/var/www/devenv/pkolla/queries/queryhandler.py', 35, 'process', 
> 'dto = errors.get_dto(self.context.error_handler, "error_query_execution", 
> [name, parameters])'), ('/var/www/devenv/pkolla/errors.py', 11, 'get_dto', 
> 'client_error = error_handler.handle(error_type, state_object)')], trace:[('/
> var/www/devenv/pkolla/queries/queryhandler.py', 32, 'process', 'result = 
> self.query.execute()'), ('/var/www/devenv/pkolla/queries/
> ListPersonsByLastnameLike.py', 28, 'execute', 'raise ValueError'), <class 
> 'ValueError'>, ValueError()]
> 
> 


I respawn this thread as the new modular-protocol-design will allow us to make 
funny tricks to get
better debugging of what is happening under the hood.

this is the uwsgi protocol manager:

http://projects.unbit.it/uwsgi/browser/proto/uwsgi.c

as you can see it is very easy to understand.

My idea is adding another "protocol", something like "uwsgidump" that is the 
same code
but with uwsgi_log() all over the place that will report all the data the uwsgi 
client will send (included http body) and
what the parser is doing with them.

when you have a problem simply add --protocol=uwsgidump and you have done.

protocol will be able to be loaded by plugins soon, so user can add them 
dinamically and implement new solutions (for example you can develop a protocol 
plugin
that will write to disk [hint:or to the uWSGI cache] every chunk of your app 
response).

--
Roberto De Ioris
http://unbit.it

_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to