Source code contains odd syntax: % CRLF %
Hi, I am building Enginio source code myself.
However when the compiler does not recognize odd syntax: % CRLF %. Many implementation use this odd syntax that causes compile error:
@ const QString request = QLatin1String("GET ") % url.path(QUrl::FullyEncoded) % QChar::fromLatin1('?')
% url.query(QUrl::FullyEncoded) % QLatin1String(" HTTP/1.1") % CRLF %
QLatin1String("Host: ") % url.host(QUrl::FullyEncoded) % QChar::fromLatin1(':') % QString::number(url.port(8080)) % CRLF % QLatin1String("Upgrade: websocket") % CRLF % QLatin1String("Connection: upgrade") % CRLF % QLatin1String("Sec-WebSocket-Key: ") % QString::fromUtf8(secWebSocketKeyBase64) % CRLF % QLatin1String("Sec-WebSocket-Version: 13") % CRLF % CRLF;
How to get these code pass compilation?
Search and replace? CRLF is a linefeed and happens sometimes between Unix / Windows conversion. You can try to read all files using notepad++ which mostly reads the files correct and then save these files again and perhaps it will be in the right format.
Hope this helps.. it's a wild guess :-)
Thank you, By now, I've replaced '%' with '+' which I thought would be connecting strings.
What is exact error message?
In this piece you are building a HTTP request, where each field must be separated by pair CR LF.
So CRLF here is a constant defined somewhere else and looks something like
const QLatin1String CRLF("\r\n");
String concatenation with % is possible if you use "QStringBuilder":https://qt-project.org/wiki/UsingQStringEffectively#6c7f5f5135b4092d900571aab77097fd
You probably broke QStringBuilder compilation somehow. "%" syntax is optional and you can safely replace it by "+", in this case maybe with a small performance penalty.