Skip to content
Snippets Groups Projects
NorFoundHandler.cpp 2.95 KiB
Newer Older
Armin Felder's avatar
Armin Felder committed
/********************************************************************************************************************
 *                                                                                                                  *
 * Copyright (C) 2017 Armin Felder                                                                                  *
 * This file is part of RocketChatMobilePushGateway <https://git.fairkom.net/chat/RocketChatMobilePushGateway>.     *
 *                                                                                                                  *
 * RocketChatMobilePushGateway is free software: you can redistribute it and/or modify                              *
 * it under the terms of the GNU General Public License as published by                                             *
 * the Free Software Foundation, either version 3 of the License, or                                                *
 * (at your option) any later version.                                                                              *
 *                                                                                                                  *
 * RocketChatMobilePushGateway is distributed in the hope that it will be useful,                                   *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of                                                   *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                                    *
 * GNU General Public License for more details.                                                                     *
 *                                                                                                                  *
 * You should have received a copy of the GNU General Public License                                                *
 * along with RocketChatMobilePushGateway. If not, see <http://www.gnu.org/licenses/>.                              *
 *                                                                                                                  *
 ********************************************************************************************************************/
Armin Felder's avatar
Armin Felder committed
#include "NorFoundHandler.h"
Armin Felder's avatar
Armin Felder committed
NotFoundHandler::NotFoundHandler() {
Armin Felder's avatar
Armin Felder committed
void NotFoundHandler::onRequest(std::unique_ptr<proxygen::HTTPMessage> headers) noexcept {
Armin Felder's avatar
Armin Felder committed
void NotFoundHandler::onBody(std::unique_ptr<folly::IOBuf> body) noexcept {
    if(mBody){
        mBody->prependChain(std::move(body));
    } else{
        mBody = std::move(body);
    }
}

Armin Felder's avatar
Armin Felder committed
void NotFoundHandler::onEOM() noexcept {
    ResponseBuilder(downstream_).status(404, "NOT FOUND")
            .header("Set-Cookie", "test=123;Max-Age=60").body("not found").sendWithEOM();
Armin Felder's avatar
Armin Felder committed
void NotFoundHandler::onUpgrade(proxygen::UpgradeProtocol proto) noexcept {
Armin Felder's avatar
Armin Felder committed
void NotFoundHandler::requestComplete() noexcept {
Armin Felder's avatar
Armin Felder committed
void NotFoundHandler::onError(proxygen::ProxygenError err) noexcept {