parse_header_parameters
Parse a Content-type like header. Return the main content-type and a dictionary of options.
If line is longer than max_length, ValueError is raised.
def parse_header_parameters(
line: string,
max_length: integer = MAX_HEADER_LENGTH
) - > tuple
Parse a Content-type like header. Return the main content-type and a dictionary of options. If line is longer than max_length, ValueError is raised.
Parameters
| Name | Type | Description |
|---|---|---|
| line | string | The raw header string to be parsed, typically from a Content-Type or Content-Disposition header. |
| max_length | integer = MAX_HEADER_LENGTH | The maximum allowed length of the input string to prevent resource exhaustion; defaults to a predefined system limit. |
Returns
| Type | Description |
|---|---|
tuple | A tuple containing the main content-type as a lowercase string and a dictionary of parsed parameters and their values. |