Skip to content
Snippets Groups Projects
Commit 4ef373ce authored by Pranav Kant's avatar Pranav Kant
Browse files

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
parent 8cbcf9a4
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment