6fe96901c9
CheckFileInfo requests can now redirect to a new URL. Change-Id: I7579ac37235b1a2ac1d7091366f0046cf889ce15 Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
57 lines
2.1 KiB
C++
57 lines
2.1 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
|
/*
|
|
* Copyright the Collabora Online contributors.
|
|
*
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#include "RequestDetails.hpp"
|
|
#include <Storage.hpp>
|
|
#include "WebSocketHandler.hpp"
|
|
|
|
#include <string>
|
|
|
|
class RequestVettingStation
|
|
{
|
|
public:
|
|
RequestVettingStation(std::string id, std::shared_ptr<WebSocketHandler> ws,
|
|
const RequestDetails& requestDetails,
|
|
const std::shared_ptr<StreamSocket>& socket, unsigned mobileAppDocId)
|
|
: _id(std::move(id))
|
|
, _ws(ws)
|
|
, _requestDetails(requestDetails)
|
|
, _socket(socket)
|
|
, _mobileAppDocId(mobileAppDocId)
|
|
{
|
|
// Indicate to the client that document broker is searching.
|
|
static const std::string status("statusindicator: find");
|
|
LOG_TRC("Sending to Client [" << status << "].");
|
|
_ws->sendMessage(status);
|
|
}
|
|
|
|
inline void logPrefix(std::ostream& os) const { os << '#' << _socket->getFD() << ": "; }
|
|
|
|
void handleRequest(SocketPoll& poll, SocketDisposition& disposition);
|
|
|
|
private:
|
|
void createDocBroker(const std::string& docKey, const std::string& url,
|
|
const Poco::URI& uriPublic, const bool isReadOnly,
|
|
Poco::JSON::Object::Ptr wopiInfo = nullptr);
|
|
|
|
void checkFileInfo(SocketPoll& poll, const std::string& url, const Poco::URI& uriPublic,
|
|
const std::string& docKey, bool isReadOnly, int redirectionLimit);
|
|
|
|
private:
|
|
const std::string _id;
|
|
std::shared_ptr<WebSocketHandler> _ws;
|
|
const RequestDetails _requestDetails;
|
|
const std::shared_ptr<StreamSocket> _socket;
|
|
std::shared_ptr<http::Session> _httpSession;
|
|
const unsigned _mobileAppDocId;
|
|
std::unique_ptr<WopiStorage::WOPIFileInfo> _wopiInfo;
|
|
LockContext _lockCtx;
|
|
};
|