On 02.07.2012, at 12:21, Roberto De Ioris wrote:

> 
>> To explain my problem better, please see following (incomplete pseudo)
>> code:
>> 
>> import webob
>> 
>> class Decider:
>>   def handle(self, env):
>>       request = webob.Request(env.copy())
>>       if request.charset is None:
>>           request.charset = 'utf8'
>>       # do something more useful here
>>       port = random.randint(request.POST['start'], request.POST['end'])
>> 
>> 
>> def application(env, start_response):
>>   router = Decider()
>>   port = router.handle(env)
>>   # we have various uwsgi servers awaiting http requests at ports 30XX
>> (start < XX < end)
>>   fd = ':30' + str(port)
>>   # webob.Request creation will read body, is there a way to rewind?
>>   env['wsgi.input'].read(-1)
>>   for part in uwsgi.send_message(fd, 0, 0, env, 0,
>> env['wsgi.input'].fileno(), uwsgi.cl()):
>>       yield part
>> 
>> Setup is a uwsgi emporer setup, 1 router (code above), and a certain
>> number of uwsgi servers with http-sockes awaiting requests.
>> 
>> Can I use uwsgi to solve this problem?
>> 
>> Thanks,
>> Kaweh
>> 
> 
> Hi Kaweh, sorry i am at europython so i am not able to check if the whole
> custom routing part is healthy.

Thanks Roberto, have a good time at EuroPython.

> By the way the uwsgi.send_message function
> build uwsgi packet, si your instance have to open a uwsgi socket too
> (--socket <address>)

Yes, all targets are behind uwsgi and respective -- sockets. My Problem is, 
that I haven't found a way to read the http body in my router (to make a 
routing decision) and forward the body via uwsgi.send_message.

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

Reply via email to