Add info to RequestEntityTooLarge exception.
Add 2 parameters to RequestEntityTooLarge exception:
blob_length - The size of the blob
limit - maximum number of bytes the reader should allow
Change-Id: I32bd4381f2b7b20f2fe642ffc71821872108471c
(cherry picked from commit 25992053e4
)
This commit is contained in:
parent
d6309b6b9b
commit
17d4be2511
|
@ -200,7 +200,12 @@ class LimitingReader(object):
|
|||
self.sha1.update(res)
|
||||
self.sha256.update(res)
|
||||
if self.bytes_read > self.limit:
|
||||
raise exception.RequestEntityTooLarge()
|
||||
message = (_("The server is refusing to process a request because"
|
||||
" the request entity with size of %(blob_length)s"
|
||||
" bytes, is larger than the server is willing or able"
|
||||
" to process - %(limit)s bytes.") %
|
||||
{"blob_length": len_result, "limit": self.limit})
|
||||
raise exception.RequestEntityTooLarge(message=message)
|
||||
return res
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue