Handle multiple header values in SPDY

SPDY sends multiple header values for the same header key by null-byte
separating them.

This patch maps the multiple values the same way
qnetworkreplyhttpimpl.cpp
does. With this patch applied we can now log on to GMail using SPDY.

Change-Id: I03656ad1695d13b5c3ed252794dc6c89c67c7b97
Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
This commit is contained in:
Allan Sandfeld Jensen 2014-02-26 18:09:34 +01:00 committed by The Qt Project
parent 9d2d4ad483
commit 1a6a763254

View File

@ -912,6 +912,19 @@ void QSpdyProtocolHandler::parseHttpHeaders(char flags, const QByteArray &frameD
} else if (name == "content-length") {
httpReply->setContentLength(value.toLongLong());
} else {
if (value.contains('\0')) {
QList<QByteArray> values = value.split('\0');
QByteArray binder(", ");
if (name == "set-cookie")
binder = "\n";
value.clear();
Q_FOREACH (const QByteArray& ivalue, values) {
if (value.isEmpty())
value = ivalue;
else
value += binder + ivalue;
}
}
httpReply->setHeaderField(name, value);
}
}