# Path: oslo_middleware/_i18n.py

# 
# Path: oslo_middleware/base.py
# class NoContentTypeResponse(webob.response.Response):
# class NoContentTypeRequest(webob.request.Request):
# class ConfigurableMiddleware(object):
# class Middleware(ConfigurableMiddleware):
#     def factory(cls, global_conf, **local_conf):
#         def middleware_filter(app):
#     def __init__(self, application, conf=None):
#     def _conf_get(self, key, group="oslo_middleware"):
#     def process_request(req):
#     def process_response(response, request=None):
#     def __call__(self, req):
#     def factory(cls, global_conf, **local_conf):


import logging
import webob.dec
import webob.exc
from oslo_config import cfg
from oslo_middleware._i18n import _
from oslo_middleware import base
                raise webob.exc.HTTPRequestEntityTooLarge(explanation=msg)
            else:
                yield chunk

    def read(self, i=None):
        # NOTE(jamielennox): We can't simply provide the default to the read()
        # call as the expected default differs between mod_wsgi and eventlet
        if i is None:
            result = self.data.read()
        else:
            result = self.data.read(i)
        self.bytes_read += len(result)
        if self.bytes_read > self.limit:
            msg = _("Request is too large. Larger than %s.") % self.limit
            raise webob.exc.HTTPRequestEntityTooLarge(explanation=msg)
        return result


class RequestBodySizeLimiter(base.ConfigurableMiddleware):
    """Limit the size of incoming requests."""

    def __init__(self, application, conf=None):
        super(RequestBodySizeLimiter, self).__init__(application, conf)
        self.oslo_conf.register_opts(_opts, group='oslo_middleware')

    @webob.dec.wsgify
    def __call__(self, req):
        max_size = self._conf_get('max_request_body_size')
        if (req.content_length is not None and
                req.content_length > max_size):

# Path: oslo_middleware/_i18n.py

# 
# Path: oslo_middleware/base.py
# class NoContentTypeResponse(webob.response.Response):
# class NoContentTypeRequest(webob.request.Request):
# class ConfigurableMiddleware(object):
# class Middleware(ConfigurableMiddleware):
#     def factory(cls, global_conf, **local_conf):
#         def middleware_filter(app):
#     def __init__(self, application, conf=None):
#     def _conf_get(self, key, group="oslo_middleware"):
#     def process_request(req):
#     def process_response(response, request=None):
#     def __call__(self, req):
#     def factory(cls, global_conf, **local_conf):


# Path: oslo_middleware/sizelimit.py
import logging
import webob.dec
import webob.exc
from oslo_config import cfg
from oslo_middleware._i18n import _
from oslo_middleware import base

                raise webob.exc.HTTPRequestEntityTooLarge(explanation=msg)
            else:
                yield chunk

    def read(self, i=None):
        # NOTE(jamielennox): We can't simply provide the default to the read()
        # call as the expected default differs between mod_wsgi and eventlet
        if i is None:
            result = self.data.read()
        else:
            result = self.data.read(i)
        self.bytes_read += len(result)
        if self.bytes_read > self.limit:
            msg = _("Request is too large. Larger than %s.") % self.limit
            raise webob.exc.HTTPRequestEntityTooLarge(explanation=msg)
        return result


class RequestBodySizeLimiter(base.ConfigurableMiddleware):
    """Limit the size of incoming requests."""

    def __init__(self, application, conf=None):
        super(RequestBodySizeLimiter, self).__init__(application, conf)
        self.oslo_conf.register_opts(_opts, group='oslo_middleware')

    @webob.dec.wsgify
    def __call__(self, req):
        max_size = self._conf_get('max_request_body_size')
        if (req.content_length is not None and
                req.content_length > max_size):

            msg = _("Request is too large. "