Home ⌂Doc Index ◂Up ▴

eric6.E5Network.E5RFC6266

Module implementing a Content-Disposition parser iaw. RFC 6266.

Global Attributes

None

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

normalize_ws Do LWS (linear whitespace) folding.
parse_ext_value Parse the value of an extended attribute.
parse_headers Build a ContentDisposition from header values.
parse_headers Build a ContentDisposition from header values.


Charset

A charset (RFC5987, Section 3.2.1).

Derived from

str

Class Attributes

grammar

Class Methods

None

Methods

None

Static Methods

None
Up


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

None

Class Methods

None

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

None

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.

Up


ContentDispositionValue

A complete Content-Disposition value (RFC 6266, Section 4.1).

Derived from

None

Class Attributes

grammar

Class Methods

None

Methods

None

Static Methods

None
Up


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

None

Class Methods

None

Methods

ContentDisposition Constructor
filename Public method to get the stored file name

Static Methods

None

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
Up


DispositionParm

A parameter for the Disposition-Type header (RFC6266, Section 4.1).

Derived from

str

Class Attributes

grammar

Class Methods

None

Methods

None

Static Methods

None
Up


DispositionParmList

A list of disposition parameters (RFC6266, Section 4.1).

Derived from

UniqueNamespace

Class Attributes

grammar

Class Methods

None

Methods

None

Static Methods

None
Up


DispositionType

The disposition type (RFC6266, Section 4.1).

Derived from

peg.List

Class Attributes

grammar

Class Methods

None

Methods

None

Static Methods

None
Up


DuplicateParamError

Exception raised when a parameter has been given twice.

Derived from

Exception

Class Attributes

None

Class Methods

None

Methods

None

Static Methods

None
Up


ExtDispositionParm

An extended parameter (RFC6266, Section 4.1).

Derived from

None

Class Attributes

grammar

Class Methods

None

Methods

ExtDispositionParm

Static Methods

None

ExtDispositionParm (Constructor)

ExtDispositionParm(value, name=None)
Up


ExtToken

A token introducing an extended value (RFC 6266, Section 4.1).

Derived from

peg.Symbol

Class Attributes

regex

Class Methods

None

Methods

__str__

Static Methods

None

ExtToken.__str__

__str__()
Up


ExtValue

An ext-value of an attribute (RFC 5987, Section 3.2).

Derived from

peg.List

Class Attributes

grammar

Class Methods

None

Methods

None

Static Methods

None
Up


InvalidISO8859Error

Exception raised when a byte is invalid in ISO-8859-1.

Derived from

Exception

Class Attributes

None

Class Methods

None

Methods

None

Static Methods

None
Up


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

grammar

Class Methods

None

Methods

None

Static Methods

None
Up


NoExtToken

A token introducing a normal value (RFC 6266, Section 4.1).

Derived from

peg.Symbol

Class Attributes

regex

Class Methods

None

Methods

__str__

Static Methods

None

NoExtToken.__str__

__str__()
Up


QuotedString

A quoted string (RFC 2616, Section 2.2).

Derived from

str

Class Attributes

grammar

Class Methods

None

Methods

__str__

Static Methods

None

QuotedString.__str__

__str__()
Up


Token

A token (RFC 2616, Section 2.2).

Derived from

str

Class Attributes

grammar

Class Methods

None

Methods

None

Static Methods

None
Up


UniqueNamespace

A pyPEG2 namespace which prevents setting a value twice.

Derived from

peg.Namespace

Class Attributes

None

Class Methods

None

Methods

__setitem__ Special method to set an item.

Static Methods

None

UniqueNamespace.__setitem__

__setitem__(key, value)

Special method to set an item.

key
key for the item
value
value of the item
Up


Value

A value. (RFC 2616, Section 3.6).

Derived from

str

Class Attributes

grammar

Class Methods

None

Methods

None

Static Methods

None
Up


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

grammar

Class Methods

None

Methods

None

Static Methods

None
Up


normalize_ws

normalize_ws(text)

Do LWS (linear whitespace) folding.

Up


parse_ext_value

parse_ext_value(val)

Parse the value of an extended attribute.

Up


parse_headers

parse_headers(content_disposition)

Build a ContentDisposition from header values.

content_disposition (bytes)
contents of the disposition header
Up


parse_headers

parse_headers(content_disposition)

Build a ContentDisposition from header values.

content_disposition (bytes)
contents of the disposition header
Up



Home ⌂Doc Index ◂Up ▴