diff options
author | Matthew Sherborne <msherborne@gmail.com> | 2013-02-26 10:35:42 +1000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2013-03-14 13:31:02 +0000 |
commit | 3478f1e121d84d15558d338a32315f13250cf3bb (patch) | |
tree | 94709583e91e7410881403b7010d132a6c35b22e /nova/context.py | |
parent | 2830ef14eca5695e796e8e3104528bbc8766bafa (diff) | |
download | nova-3478f1e121d84d15558d338a32315f13250cf3bb.tar.gz nova-3478f1e121d84d15558d338a32315f13250cf3bb.tar.xz nova-3478f1e121d84d15558d338a32315f13250cf3bb.zip |
Makes safe xml data calls raise 400 http error instead of 500
When we parse incoming XML safely, if there was an error raised it would
be an expat.Expat() error, which would bubble up to the api and turn
into a HTTP 500 (Internal Error)
It turns out that all the places we use the safe_xml parsing are in
Deserializers, close to the API, so in this patch we just change the
error it raises straight to nova.exception.MalformedRequest().
This causes the api to fail with the proper 400 (Malformed Request) when
it encounters corrupt XML. This is caught at
nova.api.openstack.wsgi._process_stack and __call__.
We also take the opportunity to move the new safe parser from nova.utils
to nova.api.openstack.xmlutil as the openstack api is the only thing
that uses it.
Fixes: bug #1133111
Change-Id: Ifa2ed7ee128241cfe8dbcdc5bd75194d96b6cdb5
Diffstat (limited to 'nova/context.py')
0 files changed, 0 insertions, 0 deletions