[Libreoffice-commits] online.git: wsd/FileServer.cpp

Pranav Kant pranavk at collabora.co.uk
Thu May 18 17:41:17 UTC 2017


 wsd/FileServer.cpp |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 4ef373ce5faa0c133239aa6704c5d16e9db89229
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Thu May 18 22:54:44 2017 +0530

    wsd: Echo back port number in CSP too if found in Referer header
    
    Otherwise, WOPI implementations that use non-standard ports get CSP
    voilation errors in the browsers because Poco's URI::getHost() method
    strips the port number from the host.
    
    No harm in mentioning the port number always even if its a standard one,
    so always use Poco::URI::getPort() to append the port to the frame
    ancestor.
    
    Change-Id: I9e7a7021b38f717e14af3d389e30f24ecaf6d122

diff --git a/wsd/FileServer.cpp b/wsd/FileServer.cpp
index 60b6a710..769193ba 100644
--- a/wsd/FileServer.cpp
+++ b/wsd/FileServer.cpp
@@ -507,7 +507,8 @@ void FileServerRequestHandler::preprocessFile(const HTTPRequest& request, Poco::
     Poco::URI uriFrameAncestor(frameAncestor);
     if (!frameAncestor.empty() && !uriFrameAncestor.getScheme().empty() && !uriFrameAncestor.getHost().empty())
     {
-        frameAncestor = uriFrameAncestor.getScheme() + "://" + uriFrameAncestor.getHost();
+        frameAncestor = uriFrameAncestor.getScheme() + "://" + uriFrameAncestor.getHost() + ":" + std::to_string(uriFrameAncestor.getPort());
+
         LOG_TRC("Final frame ancestor: " << frameAncestor);
 
         // Replaced by frame-ancestors in CSP but some oldies don't know about that


More information about the Libreoffice-commits mailing list