Skip to content

Commit

Permalink
Treat the Content-Disposition header as a known header
Browse files Browse the repository at this point in the history
Change-Id: I307f67b10759d17f603a340b14266ab47d195497
Reviewed-by: Timur Pocheptsov <[email protected]>
  • Loading branch information
AndyShawQt committed May 14, 2018
1 parent 3909d37 commit bb6ba17
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/network/access/qnetworkrequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,8 @@ static int parseHeaderName(const QByteArray &headerName)
return QNetworkRequest::ContentLengthHeader;
else if (qstricmp(headerName.constData(), "cookie") == 0)
return QNetworkRequest::CookieHeader;
else if (qstricmp(headerName.constData(), "content-disposition") == 0)
return QNetworkRequest::ContentDispositionHeader;
break;

case 'l':
Expand Down Expand Up @@ -944,6 +946,7 @@ static QVariant parseHeaderValue(QNetworkRequest::KnownHeaders header, const QBy
case QNetworkRequest::UserAgentHeader:
case QNetworkRequest::ServerHeader:
case QNetworkRequest::ContentTypeHeader:
case QNetworkRequest::ContentDispositionHeader:
// copy exactly, convert to QString
return QString::fromLatin1(value);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,9 @@ void tst_QNetworkRequest::rawHeaderParsing_data()
<< QVariant::fromValue(QList<QNetworkCookie>() << cookie << cookie2)
<< true << "Set-Cookie"
<< "a=b; path=/\nc=d";
QTest::newRow("Content-Disposition") << QNetworkRequest::ContentDispositionHeader
<< QVariant("attachment; filename=\"test.txt\"") << true
<< "Content-Disposition" << "attachment; filename=\"test.txt\"";
}

void tst_QNetworkRequest::rawHeaderParsing()
Expand Down

0 comments on commit bb6ba17

Please sign in to comment.