update cpp qt5 server samples

This commit is contained in:
William Cheng 2022-01-04 15:21:15 +08:00
parent 74f39b442e
commit 98a28a075a

View File

@ -46,7 +46,7 @@ protected:
if (socket->bytesAvailable() >= socket->contentLength()) { if (socket->bytesAvailable() >= socket->contentLength()) {
emit requestReceived(socket); emit requestReceived(socket);
} else { } else {
connect(socket, &Socket::readChannelFinished, [this, socket, m]() { connect(socket, &QHttpEngine::Socket::readChannelFinished, [this, socket]() {
emit requestReceived(socket); emit requestReceived(socket);
}); });
} }
@ -105,7 +105,7 @@ private :
} }
inline QRegularExpressionMatch getRequestMatch(QString serverTemplatePath, QString requestPath){ inline QRegularExpressionMatch getRequestMatch(QString serverTemplatePath, QString requestPath){
QRegularExpression parExpr( R"(\{([^\/\\s]+)\})" ); QRegularExpression parExpr( R"(\{([^\/\s]+)\})" );
serverTemplatePath.replace( parExpr, R"((?<\1>[^\/\s]+))" ); serverTemplatePath.replace( parExpr, R"((?<\1>[^\/\s]+))" );
serverTemplatePath.append("[\\/]?$"); serverTemplatePath.append("[\\/]?$");
QRegularExpression pathExpr( serverTemplatePath ); QRegularExpression pathExpr( serverTemplatePath );
@ -117,4 +117,4 @@ private :
} }
#endif // OAI_APIROUTER_H #endif // OAI_APIROUTER_H