code: def add_size_info (self):
          
          if self.headers and "Content-Length" in self.headers and \
             "Transfer-Encoding" not in self.headers:
              # Note that content-encoding causes size differences since
              # the content data is always decoded.
              try:
                  self.size = int(self.getheader("Content-Length"))
              except (ValueError, OverflowError):
                  pass
          else:
              self.size = -1
docs: Get size of URL content from HTTP header.