Skip to content

Commit 40b2d76

Browse files
committed
try remove
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com> Change-Id: Iab6773b56335869f53265292824bb8abc15d95be
1 parent 53631e5 commit 40b2d76

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

wsd/ClientRequestDispatcher.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ void ClientRequestDispatcher::handleIncomingMessage(SocketDisposition& dispositi
701701
if (!socket->parseHeader("Client", startmessage, request, _lastSeenHTTPHeader, map))
702702
return;
703703

704-
fprintf(stderr, "2: size of message is %ld for %s\n", socket->getInBuffer().size(), requestDetails.toString().c_str());
704+
// fprintf(stderr, "2: size of message is %ld for %s\n", socket->getInBuffer().size(), requestDetails.toString().c_str());
705705

706706
const bool closeConnection = !request.getKeepAlive(); // HTTP/1.1: closeConnection true w/ "Connection: close" only!
707707
LOG_DBG("Handling request: " << request.getURI() << ", closeConnection " << closeConnection);

wsd/ClientSession.cpp

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,11 +2011,13 @@ bool ClientSession::postProcessCopyPayload(std::vector<char>& data)
20112011
return true;
20122012
}
20132013

2014+
#if 0
20142015
// The content may not be json or any textual form. For example:
20152016
// clipboardcontent: content.application/x-openoffice-svxb;windows_formatname="SVXB (StarView Bitmap/Animation)"
20162017
// Do not issue this in those cases. (We should also cap the data we dump here.)
20172018
LOG_DBG("Missing <body> in textselectioncontent/clipboardcontent payload:\n"
20182019
<< [data](auto& log) { Util::dumpHex(log, data); });
2020+
#endif
20192021

20202022
return false;
20212023
}
@@ -2441,7 +2443,7 @@ bool ClientSession::handleKitToClientMessage(const std::shared_ptr<Message>& pay
24412443

24422444
// TEMP
24432445
std::vector<char> res;
2444-
if (FileUtil::readFile(clipFile, res, f.size()) != f.size())
2446+
if (FileUtil::readFile(clipFile, res, f.size()) != static_cast<ssize_t>(f.size()))
24452447
fprintf(stderr, "broken read\n");
24462448
else
24472449
fprintf(stderr, "good read of %ld from %s\n", res.size(), clipFile.c_str());
@@ -2451,11 +2453,11 @@ bool ClientSession::handleKitToClientMessage(const std::shared_ptr<Message>& pay
24512453

24522454
std::cerr << "FOO len: " << res.size() << "\n";
24532455

2454-
FileUtil::removeFile(std::string("/tmp/cliptest"));
2455-
std::ofstream fileStream;
2456-
fileStream.open("/tmp/cliptest");
2457-
fileStream.write(res.data(), res.size());
2458-
fileStream.close();
2456+
// FileUtil::removeFile(std::string("/tmp/cliptest"));
2457+
// std::ofstream fileStream;
2458+
// fileStream.open("/tmp/cliptest");
2459+
// fileStream.write(res.data(), res.size());
2460+
// fileStream.close();
24592461

24602462
// final cleanup ...
24612463
bool removeClipFile = true;
@@ -2492,8 +2494,17 @@ bool ClientSession::handleKitToClientMessage(const std::shared_ptr<Message>& pay
24922494
headers.emplace_back("Cache-Control", "no-cache");
24932495
headers.emplace_back("Connection", "close");
24942496

2495-
// session->asyncUpload(clipFile, std::move(headers));
2496-
session->asyncUpload("/tmp/cliptest", std::move(headers));
2497+
if (removeClipFile)
2498+
{
2499+
fprintf(stderr, "we will want to remove %s\n", clipFile.c_str());
2500+
session->setFinishedHandler([clipFile](const std::shared_ptr<http::ServerSession>&) {
2501+
fprintf(stderr, "FINISHED WITH %s\n", clipFile.c_str());
2502+
FileUtil::removeFile(clipFile);
2503+
});
2504+
}
2505+
2506+
session->asyncUpload(clipFile, std::move(headers));
2507+
// session->asyncUpload("/tmp/cliptest", std::move(headers));
24972508
socket->setHandler(std::static_pointer_cast<ProtocolHandlerInterface>(session));
24982509

24992510
LOG_INF("Queued " << (empty?"empty":"clipboard") << " response for send.");

0 commit comments

Comments
 (0)