The implementations appears to raise a 500 instead of a 400, and includes a full backtrace in the response. A 400 with message related to XML parsing should be returned instead:
$ curl -v -X POST -H Content-Type:application/xml localhost:5000/v2.0/tokens -d '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><auth xmlns="http://docs.openstack.org/identity/api/v2.0"><passwordCredentials username="test" password="test321&sdf"/></auth>'
* About to connect() to localhost port 5000 (#0)
* Trying ::1...
* Connection refused
* Trying 127.0.0.1...
* connected
* Connected to localhost (127.0.0.1) port 5000 (#0)
> POST /v2.0/tokens HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5
> Host: localhost:5000
> Accept: */*
> Content-Type:application/xml
> Content-Length: 181
>
* upload completely sent off: 181 out of 181 bytes
< HTTP/1.1 500 Internal Server Error
< Content-Type: text/plain
< Content-Length: 5883
< Date: Wed, 06 Mar 2013 20:44:01 GMT
< Connection: close
<
Traceback (most recent call last):
File "/Users/dolph/Environments/os/lib/python2.7/site-packages/eventlet/wsgi.py", line 383, in handle_one_response
result = self.application(self.environ, start_response)
File "/Users/dolph/Environments/os/lib/python2.7/site-packages/paste/urlmap.py", line 203, in __call__
return app(environ, start_response)
File "/Users/dolph/Environments/os/lib/python2.7/site-packages/webob/dec.py", line 130, in __call__
resp = self.call_func(req, *args, **self.kwargs)
File "/Users/dolph/Environments/os/lib/python2.7/site-packages/webob/dec.py", line 195, in call_func
return self.func(req, *args, **kwargs)
File "/Users/dolph/Projects/keystone/keystone/contrib/access/core.py", line 49, in __call__
response = request.get_response(self.application)
File "/Users/dolph/Environments/os/lib/python2.7/site-packages/webob/request.py", line 1296, in send
application, catch_exc_info=False)
File "/Users/dolph/Environments/os/lib/python2.7/site-packages/webob/request.py", line 1260, in call_application
app_iter = application(self.environ, start_response)
File "/Users/dolph/Environments/os/lib/python2.7/site-packages/webob/dec.py", line 144, in __call__
return resp(environ, start_response)
File "/Users/dolph/Environments/os/lib/python2.7/site-packages/webob/dec.py", line 130, in __call__
resp = self.call_func(req, *args, **self.kwargs)
File "/Users/dolph/Environments/os/lib/python2.7/site-packages/webob/dec.py", line 195, in call_func
return self.func(req, *args, **kwargs)
File "/Users/dolph/Projects/keystone/keystone/common/wsgi.py", line 353, in __call__
response = request.get_response(self.application)
File "/Users/dolph/Environments/os/lib/python2.7/site-packages/webob/request.py", line 1296, in send
application, catch_exc_info=False)
File "/Users/dolph/Environments/os/lib/python2.7/site-packages/webob/request.py", line 1260, in call_application
app_iter = application(self.environ, start_response)
File "/Users/dolph/Environments/os/lib/python2.7/site-packages/webob/dec.py", line 130, in __call__
resp = self.call_func(req, *args, **self.kwargs)
File "/Users/dolph/Environments/os/lib/python2.7/site-packages/webob/dec.py", line 195, in call_func
return self.func(req, *args, **kwargs)
File "/Users/dolph/Projects/keystone/keystone/common/wsgi.py", line 353, in __call__
response = request.get_response(self.application)
File "/Users/dolph/Environments/os/lib/python2.7/site-packages/webob/request.py", line 1296, in send
application, catch_exc_info=False)
File "/Users/dolph/Environments/os/lib/python2.7/site-packages/webob/request.py", line 1260, in call_application
app_iter = application(self.environ, start_response)
File "/Users/dolph/Environments/os/lib/python2.7/site-packages/webob/dec.py", line 130, in __call__
resp = self.call_func(req, *args, **self.kwargs)
File "/Users/dolph/Environments/os/lib/python2.7/site-packages/webob/dec.py", line 195, in call_func
return self.func(req, *args, **kwargs)
File "/Users/dolph/Projects/keystone/keystone/common/wsgi.py", line 353, in __call__
response = request.get_response(self.application)
File "/Users/dolph/Environments/os/lib/python2.7/site-packages/webob/request.py", line 1296, in send
application, catch_exc_info=False)
File "/Users/dolph/Environments/os/lib/python2.7/site-packages/webob/request.py", line 1260, in call_application
app_iter = application(self.environ, start_response)
File "/Users/dolph/Environments/os/lib/python2.7/site-packages/webob/dec.py", line 130, in __call__
resp = self.call_func(req, *args, **self.kwargs)
File "/Users/dolph/Environments/os/lib/python2.7/site-packages/webob/dec.py", line 195, in call_func
return self.func(req, *args, **kwargs)
File "/Users/dolph/Projects/keystone/keystone/common/wsgi.py", line 353, in __call__
response = request.get_response(self.application)
File "/Users/dolph/Environments/os/lib/python2.7/site-packages/webob/request.py", line 1296, in send
application, catch_exc_info=False)
File "/Users/dolph/Environments/os/lib/python2.7/site-packages/webob/request.py", line 1260, in call_application
app_iter = application(self.environ, start_response)
File "/Users/dolph/Environments/os/lib/python2.7/site-packages/webob/dec.py", line 130, in __call__
resp = self.call_func(req, *args, **self.kwargs)
File "/Users/dolph/Environments/os/lib/python2.7/site-packages/webob/dec.py", line 195, in call_func
return self.func(req, *args, **kwargs)
File "/Users/dolph/Projects/keystone/keystone/common/wsgi.py", line 350, in __call__
response = self.process_request(request)
File "/Users/dolph/Projects/keystone/keystone/middleware/core.py", line 152, in process_request
request.body = jsonutils.dumps(serializer.from_xml(request.body))
File "/Users/dolph/Projects/keystone/keystone/common/serializer.py", line 58, in from_xml
return deserializer(xml)
File "/Users/dolph/Projects/keystone/keystone/common/serializer.py", line 73, in __call__
dom = etree.fromstring(xml_str.strip(), PARSER)
File "lxml.etree.pyx", line 2969, in lxml.etree.fromstring (src/lxml/lxml.etree.c:61978)
File "parser.pxi", line 1594, in lxml.etree._parseMemoryDocument (src/lxml/lxml.etree.c:91544)
File "parser.pxi", line 1473, in lxml.etree._parseDoc (src/lxml/lxml.etree.c:90361)
File "parser.pxi", line 988, in lxml.etree._BaseParser._parseDoc (src/lxml/lxml.etree.c:87024)
File "parser.pxi", line 565, in lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:82877)
File "parser.pxi", line 656, in lxml.etree._handleParseResult (src/lxml/lxml.etree.c:83862)
File "parser.pxi", line 596, in lxml.etree._raiseParseError (src/lxml/lxml.etree.c:83186)
XMLSyntaxError: EntityRef: expecting ';', line 1, column 115
* Closing connection #0
The implementations appears to raise a 500 instead of a 400, and includes a full backtrace in the response. A 400 with message related to XML parsing should be returned instead:
$ curl -v -X POST -H Content- Type:applicatio n/xml localhost: 5000/v2. 0/tokens -d '<?xml version="1.0" encoding="UTF-8" standalone= "yes"?> <auth xmlns="http:// docs.openstack. org/identity/ api/v2. 0"><passwordCred entials username="test" password= "test321& sdf"/>< /auth>' apple-darwin12. 0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5 Type:applicatio n/xml dolph/Environme nts/os/ lib/python2. 7/site- packages/ eventlet/ wsgi.py" , line 383, in handle_one_response n(self. environ, start_response) dolph/Environme nts/os/ lib/python2. 7/site- packages/ paste/urlmap. py", line 203, in __call__ dolph/Environme nts/os/ lib/python2. 7/site- packages/ webob/dec. py", line 130, in __call__ dolph/Environme nts/os/ lib/python2. 7/site- packages/ webob/dec. py", line 195, in call_func dolph/Projects/ keystone/ keystone/ contrib/ access/ core.py" , line 49, in __call__ get_response( self.applicatio n) dolph/Environme nts/os/ lib/python2. 7/site- packages/ webob/request. py", line 1296, in send info=False) dolph/Environme nts/os/ lib/python2. 7/site- packages/ webob/request. py", line 1260, in call_application self.environ, start_response) dolph/Environme nts/os/ lib/python2. 7/site- packages/ webob/dec. py", line 144, in __call__ dolph/Environme nts/os/ lib/python2. 7/site- packages/ webob/dec. py", line 130, in __call__ dolph/Environme nts/os/ lib/python2. 7/site- packages/ webob/dec. py", line 195, in call_func dolph/Projects/ keystone/ keystone/ common/ wsgi.py" , line 353, in __call__ get_response( self.applicatio n) dolph/Environme nts/os/ lib/python2. 7/site- packages/ webob/request. py", line 1296, in send info=False) dolph/Environme nts/os/ lib/python2. 7/site- packages/ webob/request. py", line 1260, in call_application self.environ, start_response) dolph/Environme nts/os/ lib/python2. 7/site- packages/ webob/dec. py", line 130, in __call__ dolph/Environme nts/os/ lib/python2. 7/site- packages/ webob/dec. py", line 195, in call_func dolph/Projects/ keystone/ keystone/ common/ wsgi.py" , line 353, in __call__ get_response( self.applicatio n) dolph/Environme nts/os/ lib/python2. 7/site- packages/ webob/request. py", line 1296, in send info=False) dolph/Environme nts/os/ lib/python2. 7/site- packages/ webob/request. py", line 1260, in call_application self.environ, start_response) dolph/Environme nts/os/ lib/python2. 7/site- packages/ webob/dec. py", line 130, in __call__ dolph/Environme nts/os/ lib/python2. 7/site- packages/ webob/dec. py", line 195, in call_func dolph/Projects/ keystone/ keystone/ common/ wsgi.py" , line 353, in __call__ get_response( self.applicatio n) dolph/Environme nts/os/ lib/python2. 7/site- packages/ webob/request. py", line 1296, in send info=False) dolph/Environme nts/os/ lib/python2. 7/site- packages/ webob/request. py", line 1260, in call_application self.environ, start_response) dolph/Environme nts/os/ lib/python2. 7/site- packages/ webob/dec. py", line 130, in __call__ dolph/Environme nts/os/ lib/python2. 7/site- packages/ webob/dec. py", line 195, in call_func dolph/Projects/ keystone/ keystone/ common/ wsgi.py" , line 353, in __call__ get_response( self.applicatio n) dolph/Environme nts/os/ lib/python2. 7/site- packages/ webob/request. py", line 1296, in send info=False) dolph/Environme nts/os/ lib/python2. 7/site- packages/ webob/request. py", line 1260, in call_application self.environ, start_response) dolph/Environme nts/os/ lib/python2. 7/site- packages/ webob/dec. py", line 130, in __call__ dolph/Environme nts/os/ lib/python2. 7/site- packages/ webob/dec. py", line 195, in call_func dolph/Projects/ keystone/ keystone/ common/ wsgi.py" , line 350, in __call__ request( request) dolph/Projects/ keystone/ keystone/ middleware/ core.py" , line 152, in process_request dumps(serialize r.from_ xml(request. body)) dolph/Projects/ keystone/ keystone/ common/ serializer. py", line 58, in from_xml dolph/Projects/ keystone/ keystone/ common/ serializer. py", line 73, in __call__ g(xml_str. strip() , PARSER) fromstring (src/lxml/ lxml.etree. c:61978) _parseMemoryDoc ument (src/lxml/ lxml.etree. c:91544) _parseDoc (src/lxml/ lxml.etree. c:90361) _BaseParser. _parseDoc (src/lxml/ lxml.etree. c:87024) _ParserContext. _handleParseRes ultDoc (src/lxml/ lxml.etree. c:82877) _handleParseRes ult (src/lxml/ lxml.etree. c:83862) _raiseParseErro r (src/lxml/ lxml.etree. c:83186)
* About to connect() to localhost port 5000 (#0)
* Trying ::1...
* Connection refused
* Trying 127.0.0.1...
* connected
* Connected to localhost (127.0.0.1) port 5000 (#0)
> POST /v2.0/tokens HTTP/1.1
> User-Agent: curl/7.24.0 (x86_64-
> Host: localhost:5000
> Accept: */*
> Content-
> Content-Length: 181
>
* upload completely sent off: 181 out of 181 bytes
< HTTP/1.1 500 Internal Server Error
< Content-Type: text/plain
< Content-Length: 5883
< Date: Wed, 06 Mar 2013 20:44:01 GMT
< Connection: close
<
Traceback (most recent call last):
File "/Users/
result = self.applicatio
File "/Users/
return app(environ, start_response)
File "/Users/
resp = self.call_func(req, *args, **self.kwargs)
File "/Users/
return self.func(req, *args, **kwargs)
File "/Users/
response = request.
File "/Users/
application, catch_exc_
File "/Users/
app_iter = application(
File "/Users/
return resp(environ, start_response)
File "/Users/
resp = self.call_func(req, *args, **self.kwargs)
File "/Users/
return self.func(req, *args, **kwargs)
File "/Users/
response = request.
File "/Users/
application, catch_exc_
File "/Users/
app_iter = application(
File "/Users/
resp = self.call_func(req, *args, **self.kwargs)
File "/Users/
return self.func(req, *args, **kwargs)
File "/Users/
response = request.
File "/Users/
application, catch_exc_
File "/Users/
app_iter = application(
File "/Users/
resp = self.call_func(req, *args, **self.kwargs)
File "/Users/
return self.func(req, *args, **kwargs)
File "/Users/
response = request.
File "/Users/
application, catch_exc_
File "/Users/
app_iter = application(
File "/Users/
resp = self.call_func(req, *args, **self.kwargs)
File "/Users/
return self.func(req, *args, **kwargs)
File "/Users/
response = request.
File "/Users/
application, catch_exc_
File "/Users/
app_iter = application(
File "/Users/
resp = self.call_func(req, *args, **self.kwargs)
File "/Users/
return self.func(req, *args, **kwargs)
File "/Users/
response = self.process_
File "/Users/
request.body = jsonutils.
File "/Users/
return deserializer(xml)
File "/Users/
dom = etree.fromstrin
File "lxml.etree.pyx", line 2969, in lxml.etree.
File "parser.pxi", line 1594, in lxml.etree.
File "parser.pxi", line 1473, in lxml.etree.
File "parser.pxi", line 988, in lxml.etree.
File "parser.pxi", line 565, in lxml.etree.
File "parser.pxi", line 656, in lxml.etree.
File "parser.pxi", line 596, in lxml.etree.
XMLSyntaxError: EntityRef: expecting ';', line 1, column 115
* Closing connection #0