Use request.content_lenght to check for a request.body existence before accessing it
This commit is contained in:
parent
92f1e76014
commit
3aa41ec7b1
@ -130,9 +130,11 @@ class WSRoot(object):
|
||||
def _select_protocol(self, request):
|
||||
log.debug("Selecting a protocol for the following request :\n"
|
||||
"headers: %s\nbody: %s", request.headers,
|
||||
request.body and (len(request.body) > 512
|
||||
and request.body[:512]
|
||||
or request.body) or '')
|
||||
request.content_length and (
|
||||
request.content_length > 512
|
||||
and request.body[:512]
|
||||
or request.body)
|
||||
or '')
|
||||
protocol = None
|
||||
if 'wsmeproto' in request.params:
|
||||
return self._get_protocol(request.params['wsmeproto'])
|
||||
|
Loading…
x
Reference in New Issue
Block a user