mirror of https://github.com/aria2/aria2
Add workaround for noncompliant Content-Disposition headers.
Despite it not being allowed by RFC 6266, many servers send `Content-Disposition` headers with a trailing `;`, including several major content distribution networks. Add a check for a trailing semicolon in `parse_content_disposition()` which will log a message at INFO level for each offending URL and ignore the `;`.pull/2153/head
parent
5c87f1b7b6
commit
8f976f7264
10
src/util.cc
10
src/util.cc
|
@ -1245,6 +1245,16 @@ ssize_t parse_content_disposition(char* dest, size_t destlen,
|
||||||
*charsetp = nullptr;
|
*charsetp = nullptr;
|
||||||
*charsetlenp = 0;
|
*charsetlenp = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Ignore trailing ';' in Content-Disposition header; this is not
|
||||||
|
* compliant with RFC 6266, but many servers send it anyway (e.g. CloudFront)
|
||||||
|
*/
|
||||||
|
if (len > 0 && *eop == ';') {
|
||||||
|
A2_LOG_INFO("Non-compliant Content-Disposition header (trailing ';') - "
|
||||||
|
"will ignore it");
|
||||||
|
eop--;
|
||||||
|
}
|
||||||
|
|
||||||
for (; p != eop; ++p) {
|
for (; p != eop; ++p) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case CD_BEFORE_DISPOSITION_TYPE:
|
case CD_BEFORE_DISPOSITION_TYPE:
|
||||||
|
|
Loading…
Reference in New Issue