eric6.E5Network.E5RFC6266
Module implementing a Content-Disposition parser iaw. RFC 6266.
Global Attributes
Classes
Charset |
A charset (RFC5987, Section 3.2.1). |
ContentDisposition |
Records various indications and hints about content disposition. |
ContentDispositionValue |
A complete Content-Disposition value (RFC 6266, Section 4.1). |
ContentDisposition |
Records various indications and hints about content disposition. |
DispositionParm |
A parameter for the Disposition-Type header (RFC6266, Section 4.1). |
DispositionParmList |
A list of disposition parameters (RFC6266, Section 4.1). |
DispositionType |
The disposition type (RFC6266, Section 4.1). |
DuplicateParamError |
Exception raised when a parameter has been given twice. |
ExtDispositionParm |
An extended parameter (RFC6266, Section 4.1). |
ExtToken |
A token introducing an extended value (RFC 6266, Section 4.1). |
ExtValue |
An ext-value of an attribute (RFC 5987, Section 3.2). |
InvalidISO8859Error |
Exception raised when a byte is invalid in ISO-8859-1. |
Language |
A language-tag (RFC 5646, Section 2.1). |
NoExtToken |
A token introducing a normal value (RFC 6266, Section 4.1). |
QuotedString |
A quoted string (RFC 2616, Section 2.2). |
Token |
A token (RFC 2616, Section 2.2). |
UniqueNamespace |
A pyPEG2 namespace which prevents setting a value twice. |
Value |
A value. |
ValueChars |
A value of an attribute. |
Functions
Charset
A charset (RFC5987, Section 3.2.1).
Derived from
str
Class Attributes
Class Methods
Methods
Static Methods
ContentDisposition
Records various indications and hints about content disposition.
These can be used to know if a file should be downloaded or
displayed directly, and to hint what filename it should have
in the download case.
Derived from
None
Class Attributes
Class Methods
Methods
ContentDisposition |
Used internally after parsing the header. |
filename |
The filename from the Content-Disposition header or None. |
is_inline |
Return if the file should be handled inline. |
Static Methods
ContentDisposition (Constructor)
ContentDisposition(disposition='inline', assocs=None)
Used internally after parsing the header.
Instances should generally be created from a factory
function, such as parse_headers and its variants.
ContentDisposition.filename
filename()
The filename from the Content-Disposition header or None.
On safety:
This property records the intent of the sender.
You shouldn't use this sender-controlled value as a filesystem
path, it can be insecure. Serving files with this filename can be
dangerous as well, due to a certain browser using the part after
the dot for mime-sniffing. Saving it to a database is fine by
itself though.
ContentDisposition.is_inline
is_inline()
Return if the file should be handled inline.
If not, and unless your application supports other dispositions
than the standard inline and attachment, it should be handled
as an attachment.
ContentDispositionValue
A complete Content-Disposition value (RFC 6266, Section 4.1).
Derived from
None
Class Attributes
Class Methods
Methods
Static Methods
ContentDisposition
Records various indications and hints about content disposition.
These can be used to know if a file should be downloaded or
displayed directly, and to hint what filename it should have
in the download case.
Derived from
None
Class Attributes
Class Methods
Methods
Static Methods
ContentDisposition (Constructor)
ContentDisposition(filename)
Constructor
- filename (str)
-
file name to be stored in this surrogate class
ContentDisposition.filename
filename()
Public method to get the stored file name
- Returns:
-
file name
- Return Type:
-
str
DispositionParm
A parameter for the Disposition-Type header (RFC6266, Section 4.1).
Derived from
str
Class Attributes
Class Methods
Methods
Static Methods
DispositionParmList
A list of disposition parameters (RFC6266, Section 4.1).
Derived from
UniqueNamespace
Class Attributes
Class Methods
Methods
Static Methods
DispositionType
The disposition type (RFC6266, Section 4.1).
Derived from
peg.List
Class Attributes
Class Methods
Methods
Static Methods
DuplicateParamError
Exception raised when a parameter has been given twice.
Derived from
Exception
Class Attributes
Class Methods
Methods
Static Methods
ExtDispositionParm
An extended parameter (RFC6266, Section 4.1).
Derived from
None
Class Attributes
Class Methods
Methods
Static Methods
ExtDispositionParm (Constructor)
ExtDispositionParm(value, name=None)
ExtToken
A token introducing an extended value (RFC 6266, Section 4.1).
Derived from
peg.Symbol
Class Attributes
Class Methods
Methods
Static Methods
ExtToken.__str__
__str__()
ExtValue
An ext-value of an attribute (RFC 5987, Section 3.2).
Derived from
peg.List
Class Attributes
Class Methods
Methods
Static Methods
InvalidISO8859Error
Exception raised when a byte is invalid in ISO-8859-1.
Derived from
Exception
Class Attributes
Class Methods
Methods
Static Methods
Language
A language-tag (RFC 5646, Section 2.1).
Fixme: This grammar is not 100% correct yet.
https://github.com/The-Compiler/qutebrowser/issues/105
Derived from
str
Class Attributes
Class Methods
Methods
Static Methods
NoExtToken
A token introducing a normal value (RFC 6266, Section 4.1).
Derived from
peg.Symbol
Class Attributes
Class Methods
Methods
Static Methods
NoExtToken.__str__
__str__()
QuotedString
A quoted string (RFC 2616, Section 2.2).
Derived from
str
Class Attributes
Class Methods
Methods
Static Methods
QuotedString.__str__
__str__()
Token
A token (RFC 2616, Section 2.2).
Derived from
str
Class Attributes
Class Methods
Methods
Static Methods
UniqueNamespace
A pyPEG2 namespace which prevents setting a value twice.
Derived from
peg.Namespace
Class Attributes
Class Methods
Methods
Static Methods
UniqueNamespace.__setitem__
__setitem__(key, value)
Special method to set an item.
- key
-
key for the item
- value
-
value of the item
Value
A value. (RFC 2616, Section 3.6).
Derived from
str
Class Attributes
Class Methods
Methods
Static Methods
ValueChars
A value of an attribute.
Fixme: Can we merge this with Value?
https://github.com/The-Compiler/qutebrowser/issues/105
Derived from
str
Class Attributes
Class Methods
Methods
Static Methods
normalize_ws
normalize_ws(text)
Do LWS (linear whitespace) folding.
parse_ext_value
parse_ext_value(val)
Parse the value of an extended attribute.
parse_headers
parse_headers(content_disposition)
Build a ContentDisposition from header values.
- content_disposition (bytes)
-
contents of the disposition header
parse_headers
parse_headers(content_disposition)
Build a ContentDisposition from header values.
- content_disposition (bytes)
-
contents of the disposition header