Compare commits

...

2 commits

Author SHA1 Message Date
YiFang Xiao bf2ffa053e fix: [dictserver] some word does not got displayed 2024-11-17 09:12:30 +08:00
YiFang Xiao 7f760b91dc fix: [dictserver] some word does not got displayed 2024-11-17 08:47:39 +08:00

View file

@ -844,27 +844,23 @@ void DictServerArticleRequest::readData( QByteArray reply )
articleData += string( "<div class=\"dictserver_from\">" ) + dbName.toUtf8().data() + "[" + dbID.toUtf8().data() articleData += string( "<div class=\"dictserver_from\">" ) + dbName.toUtf8().data() + "[" + dbID.toUtf8().data()
+ "]" + "</div>"; + "]" + "</div>";
// Retreive MIME headers if any
static QRegularExpression contentTypeExpr( "Content-Type\\s*:\\s*text/html",
QRegularExpression::CaseInsensitiveOption );
reply = dictImpl->socket.readAll(); reply = dictImpl->socket.readAll();
articleText += reply; articleText += reply;
qDebug() << "reply data:" << reply << QDateTime::currentDateTime(); qDebug() << "reply data:" << reply << QDateTime::currentDateTime();
if ( articleText.contains( ".\r\n" ) ) { if ( articleText.contains( "\r\n.\r\n" ) ) {
//discard all left message. //discard all left message.
emit finishedArticle( articleText ); emit finishedArticle( articleText );
return; return;
} }
} }
else { else {
articleText += reply;
reply = dictImpl->socket.readAll(); reply = dictImpl->socket.readAll();
qDebug() << "reply data:" << reply << QDateTime::currentDateTime(); qDebug() << "reply data:" << reply << QDateTime::currentDateTime();
articleText += reply; articleText += reply;
if ( reply.contains( ".\r\n" ) ) { if ( reply.contains( "\r\n.\r\n" ) ) {
//discard all left message. maybe delete all the remaining data after `.\r\n` //discard all left message. maybe delete all the remaining data after `.\r\n`
emit finishedArticle( articleText ); emit finishedArticle( articleText );
return; return;