← Back to team overview

launchpad-reviewers team mailing list archive

Re: [Merge] lp:~cjwatson/launchpad/librarian-check-content-length into lp:launchpad

 

Review: Approve code



Diff comments:

> 
> === modified file 'lib/lp/services/librarian/client.py'
> --- lib/lp/services/librarian/client.py	2015-12-10 00:37:05 +0000
> +++ lib/lp/services/librarian/client.py	2016-05-31 17:06:57 +0000
> @@ -285,6 +286,18 @@
>      def __init__(self, file, url):
>          self.file = file
>          self.url = url
> +        headers = file.info()
> +        chunked = (headers.get("Transfer-Encoding") == "chunked")
> +        if not chunked and "Content-Length" in headers:

No need to be case-insensitive here?

> +            try:
> +                self.length = int(headers["Content-Length"])
> +            except ValueError:
> +                self.length = None
> +            else:
> +                if self.length < 0:
> +                    self.length = None
> +        else:
> +            self.length = None
>  
>      def read(self, chunksize=None):
>          request = get_current_browser_request()


-- 
https://code.launchpad.net/~cjwatson/launchpad/librarian-check-content-length/+merge/296120
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.


References