- # find client, update config, etc.
- ci = ipaddr(request.args['i'])
- c = clients[ci]
- pw = request.args['pw']
- if pw != c.pw: raise ValueError('bad password')
-
- # update config
-
- xxx check sanity, do not update
- for r, w in (('mbd', 'max_batch_down'),
- ('mqt', 'max_queue_time'),
- ('mrt', 'max_request_time'),
- ('tro', 'target_requests_outstanding')):
- try: v = request.args[r]
- except KeyError: continue
- v = int(v)
- c.__dict__[w] = v
-
- try: d = request.args['d']
- except KeyError: d = ''
-
- c.process_arriving_data(d)
- c.new_request(request)
+ log_debug(DBG.HTTP_FULL,
+ 'req recv: ' + repr(request) + ' ' + repr(request.args),
+ idof=id(request))
+ desca = {'d': None}
+ try: process_request(request, desca)
+ except Exception as e:
+ emsg = repr(e)
+ log_http(desca, 'EXCEPTION ' + emsg)
+ request.setHeader('Content-Type','text/plain; charset="utf-8"')
+ request.setResponseCode(400)
+ return emsg.encode('utf-8')
+ log_http(desca, '... [%s]' % id(request))
+ return NOT_DONE_YET