From e89524b31472c1997113b086053ba0d65798636f Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 17 Jan 2021 12:26:44 +0100 Subject: rfc6266: Remove more dead code --- qutebrowser/browser/webkit/rfc6266.py | 42 ----------------------------------- 1 file changed, 42 deletions(-) diff --git a/qutebrowser/browser/webkit/rfc6266.py b/qutebrowser/browser/webkit/rfc6266.py index 814fac6df..35d7895cb 100644 --- a/qutebrowser/browser/webkit/rfc6266.py +++ b/qutebrowser/browser/webkit/rfc6266.py @@ -20,41 +20,15 @@ """pyPEG parsing for the RFC 6266 (Content-Disposition) header.""" import email.headerregistry -import urllib.parse -import string -import re -import dataclasses -from typing import Optional - -import pypeg2 as peg from qutebrowser.utils import utils -@dataclasses.dataclass -class LangTagged: - - """A string with an associated language.""" - - string: str - langtag: Optional[str] - - class Error(Exception): """Base class for RFC6266 errors.""" -class DuplicateParamError(Error): - - """Exception raised when a parameter has been given twice.""" - - -class InvalidISO8859Error(Error): - - """Exception raised when a byte is invalid in ISO-8859-1.""" - - class _ContentDisposition: """Records various indications and hints about content disposition. @@ -127,19 +101,3 @@ def parse_headers(content_disposition): return _ContentDisposition(disposition=parsed.content_disposition, params=parsed.params) - - -def parse_ext_value(val): - """Parse the value of an extended attribute.""" - if len(val) == 3: - charset, langtag, coded = val - else: - charset, coded = val - langtag = None - decoded = urllib.parse.unquote(coded, charset, errors='strict') - if charset == 'iso-8859-1': - # Fail if the filename contains an invalid ISO-8859-1 char - for c in decoded: - if 0x7F <= ord(c) <= 0x9F: - raise InvalidISO8859Error(c) - return LangTagged(decoded, langtag) -- cgit v1.2.3-54-g00ecf