← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1612485] Re: 500 Error is returned when specifying string that is partial matched to "application/json" as format of HTTP header.

 

Reviewed:  https://review.openstack.org/354551
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=e99274397c974666ede9d4f1804210e6152b7238
Submitter: Jenkins
Branch:    master

commit e99274397c974666ede9d4f1804210e6152b7238
Author: hobo.kengo <hobo.kengo@xxxxxxxxxxxxxx>
Date:   Fri Aug 12 06:49:53 2016 +0000

    Check content type by completely match instead of partial match
    
    Currently, 'get_content_type' method in neutron/wsgi.py checks
    specified format by 'in' statement.
    Thus, string(e.g. 'application/j') that is partial matched to
    'application/json' is returned.
    
    However, we cannot find valid serializer from the format,
    and request fails with unexpected error.
    
    Change-Id: I75aac0308d0fd0321973c4bda3bc07ca0224e1c1
    Closes-Bug: #1612485


** Changed in: neutron
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1612485

Title:
  500 Error is returned when specifying string that is partial matched
  to "application/json" as format of HTTP header.

Status in neutron:
  Fix Released

Bug description:
  Currently, 'get_content_type' method in neutron/wsgi.py checks
  specified format by 'in' statement.
  Thus, string(e.g. 'application/j') that is partial matched to
  'application/json' is returned.

  However, we cannot find valid serializer from the format,
  and request fails with unexpected error.

  request
  ===========================
  ubuntu@neutron-ml2:/opt/stack/neutron$ curl -g -i -X GET http://172.16.1.29:9696/v2.0/networks -H "X-Auth-Token: $TOKEN" -H "Content-type: ppli"
  HTTP/1.1 500 Internal Server Error
  Content-Length: 114
  Content-Type: text/plain; charset=UTF-8
  X-Openstack-Request-Id: req-c82ae85b-dbec-49ae-ad1f-d1104c437acd
  Date: Fri, 12 Aug 2016 03:18:14 GMT

  500 Internal Server Error

  The server has either erred or is incapable of performing the requested operation.
  =============================

  trace in neutron-server
  =============================
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors Traceback (most recent call last):
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/oslo_middleware/catch_errors.py", line 38, in __call__
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     response = req.get_response(self.application)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1299, in send
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     application, catch_exc_info=False)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1263, in call_application
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     app_iter = application(self.environ, start_response)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     resp = self.call_func(req, *args, **self.kwargs)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     return self.func(req, *args, **kwargs)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/keystonemiddleware/auth_token/__init__.py", line 331, in
   __call__
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     response = req.get_response(self._app)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1299, in send
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     application, catch_exc_info=False)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1263, in call_application
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     app_iter = application(self.environ, start_response)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     return resp(environ, start_response)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     return resp(environ, start_response)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/routes/middleware.py", line 141, in __call__
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     response = self.app(environ, start_response)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     return resp(environ, start_response)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     return resp(environ, start_response)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/routes/middleware.py", line 141, in __call__
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     response = self.app(environ, start_response)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     return resp(environ, start_response)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     resp = self.call_func(req, *args, **self.kwargs)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     return self.func(req, *args, **kwargs)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors   File "/opt/stack/neutron/neutron/api/v2/resource.py", line 97, in resource
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors     body = serializer.serialize(result)
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors AttributeError: 'NoneType' object has no attribute 'serialize'
  2016-08-12 03:18:14.259 13757 ERROR oslo_middleware.catch_errors
  2016-08-12 03:18:14.262 13757 INFO neutron.wsgi [req-c82ae85b-dbec-49ae-ad1f-d1104c437acd b3ec23ec52144d7e96696abef028a5b0 7dbb594bc59546f6b26ad73da253c90a - - -] 172.16.1.29 - - [12/Aug/2016 03:18:14] "GET /v2.0/networks HTTP/1.1" 500 317 0.680435
  ===============================

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1612485/+subscriptions


References