Initialize regex only once

This code path is commonly used so let it initialize only once.
This commit is contained in:
Chocobo1 2023-06-23 03:07:45 +08:00
parent 03d3552ee0
commit b3d2ba7d07
No known key found for this signature in database
GPG key ID: 210D9C873253A68C

View file

@ -189,7 +189,7 @@ bool RequestParser::parseRequestLine(const QString &line)
{
// [rfc7230] 3.1.1. Request Line
const QRegularExpression re(u"^([A-Z]+)\\s+(\\S+)\\s+HTTP\\/(\\d\\.\\d)$"_s);
static const QRegularExpression re(u"^([A-Z]+)\\s+(\\S+)\\s+HTTP\\/(\\d\\.\\d)$"_s);
const QRegularExpressionMatch match = re.match(line);
if (!match.hasMatch())