Simplify code in QSpdyProtocolHandler::parseHttpHeaders()
Instead of checking for the presence of a NUL, then splitting the QByteArray at NUL separators just to join the parts with different binders, simply use replace('\0', ...). Change-Id: I0e0453b80f63cffce4a0ff152120ece754211166 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
This commit is contained in:
parent
db27f3d5a7
commit
7ba9863e32
@ -935,19 +935,7 @@ void QSpdyProtocolHandler::parseHttpHeaders(char flags, const QByteArray &frameD
|
|||||||
} else if (name == "content-length") {
|
} else if (name == "content-length") {
|
||||||
httpReply->setContentLength(value.toLongLong());
|
httpReply->setContentLength(value.toLongLong());
|
||||||
} else {
|
} else {
|
||||||
if (value.contains('\0')) {
|
value.replace('\0', name == "set-cookie" ? "\n" : ", ");
|
||||||
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);
|
httpReply->setHeaderField(name, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user