From b6182877a8047d5b769a5a8b53bca6030192825e Mon Sep 17 00:00:00 2001 From: Andras Timar Date: Fri, 19 Nov 2021 12:29:22 +0100 Subject: [PATCH] backward compatibility: /lool/convert-to endpoint Signed-off-by: Andras Timar Change-Id: I8a3930a01a18be32bee657142f872ba58383594d --- etc/apache2/coolwsd.conf | 3 +++ etc/nginx/coolwsd.conf | 3 ++- wsd/COOLWSD.cpp | 9 +++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/etc/apache2/coolwsd.conf b/etc/apache2/coolwsd.conf index 4796f5e5d..f7ecb6f66 100644 --- a/etc/apache2/coolwsd.conf +++ b/etc/apache2/coolwsd.conf @@ -33,3 +33,6 @@ # Download as, Fullscreen presentation and Image upload operations ProxyPass /cool http://127.0.0.1:9980/cool ProxyPassReverse /cool http://127.0.0.1:9980/cool + # Compatibility with integrations that use the /lool/convert-to endpoint + ProxyPass /lool http://127.0.0.1:9980/cool + ProxyPassReverse /lool http://127.0.0.1:9980/cool diff --git a/etc/nginx/coolwsd.conf b/etc/nginx/coolwsd.conf index b0fb7105b..6d0814ea5 100644 --- a/etc/nginx/coolwsd.conf +++ b/etc/nginx/coolwsd.conf @@ -26,7 +26,8 @@ } # download, presentation and image upload - location ~ ^/cool { + # we accept 'lool' to be backward compatible + location ~ ^/(c|l)ool { proxy_pass http://localhost:9980; proxy_set_header Host $http_host; } diff --git a/wsd/COOLWSD.cpp b/wsd/COOLWSD.cpp index 83938d067..019e75027 100644 --- a/wsd/COOLWSD.cpp +++ b/wsd/COOLWSD.cpp @@ -2804,9 +2804,12 @@ private: requestDetails.equals(2, "ws") && requestDetails.isWebSocket()) handleClientWsUpgrade(request, requestDetails, disposition, socket); - else if (!requestDetails.isWebSocket() && requestDetails.equals(RequestDetails::Field::Type, "cool")) + else if (!requestDetails.isWebSocket() && + (requestDetails.equals(RequestDetails::Field::Type, "cool") || + requestDetails.equals(RequestDetails::Field::Type, "lool"))) { - // All post requests have url prefix 'cool'. + // All post requests have url prefix 'cool', except when the prefix + // is 'lool' e.g. when integrations use the old /lool/convert-to endpoint handlePostRequest(requestDetails, request, message, disposition, socket); } else @@ -3805,6 +3808,8 @@ private: Poco::JSON::Object::Ptr convert_to = new Poco::JSON::Object; Poco::Dynamic::Var available = allowConvertTo(socket->clientAddress(), request); convert_to->set("available", available); + if (available) + convert_to->set("endpoint", "/cool/convert-to"); Poco::JSON::Object::Ptr capabilities = new Poco::JSON::Object; capabilities->set("convert-to", convert_to);