diff options
| author | Felix (xq) Queißner <git@mq32.de> | 2020-06-10 01:24:39 +0200 |
|---|---|---|
| committer | Felix (xq) Queißner <git@mq32.de> | 2020-06-10 01:24:39 +0200 |
| commit | 9b93c4d7c5a450607eca0174b1899e56d6a09a48 (patch) | |
| tree | a4cd5ac75ad9a3cd3f3a69ecbb25c53bf43fd3e8 /src/gopherclient.cpp | |
| parent | e32d4644034f0a6df8dd06c985ccfe74e7dd48f4 (diff) | |
| download | kristall-9b93c4d7c5a450607eca0174b1899e56d6a09a48.tar.gz | |
Improves gophermaps: Now handle '+' correctly, improves gopher protocol such that it now respects *the lone dot*.
Diffstat (limited to 'src/gopherclient.cpp')
| -rw-r--r-- | src/gopherclient.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gopherclient.cpp b/src/gopherclient.cpp index 17faceb..2c2cdf5 100644 --- a/src/gopherclient.cpp +++ b/src/gopherclient.cpp @@ -34,7 +34,7 @@ bool GopherClient::startRequest(const QUrl &url) else if(type == "h") mime = "text/html"; else if(type == "s") mime = "audio/unknown"; - qDebug() << url << "→" << mime; + is_processing_binary = (type == "5") or (type == "9") or (type == "I") or (type == "g"); this->requested_url = url; this->was_cancelled = false; @@ -66,6 +66,15 @@ void GopherClient::on_connected() void GopherClient::on_readRead() { body.append(socket.readAll()); + + if(not is_processing_binary) { + // Strip the "lone dot" from gopher data + if(int index = body.indexOf(".\r\n"); index >= 0) { + body.resize(index); + socket.close(); + } + } + emit this->requestProgress(body.size()); } @@ -74,7 +83,6 @@ void GopherClient::on_finished() if(not was_cancelled) { emit this->requestComplete(this->body, mime); - was_cancelled = true; } body.clear(); |
