proxygen
DirectResponseHandler.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree. An additional grant
7  * of patent rights can be found in the PATENTS file in the same directory.
8  *
9  */
10 #pragma once
11 
14 
15 namespace proxygen {
16 
21  public:
24  std::string body)
25  : code_(code),
26  message_(std::move(message)),
27  body_(folly::IOBuf::copyBuffer(body)) {
28  }
29 
30  void onRequest(std::unique_ptr<HTTPMessage> /*headers*/) noexcept override {}
31 
32  void onBody(std::unique_ptr<folly::IOBuf> /*body*/) noexcept override {}
33 
34  void onUpgrade(proxygen::UpgradeProtocol /*prot*/) noexcept override {}
35 
36  void onEOM() noexcept override {
40  .sendWithEOM();
41  }
42 
43  void requestComplete() noexcept override {
44  delete this;
45  }
46 
47  void onError(ProxygenError /*err*/) noexcept override { delete this; }
48 
49  private:
50  const int code_;
52  std::unique_ptr<folly::IOBuf> body_;
53 };
54 
55 }
Definition: test.c:42
ResponseBuilder & status(uint16_t code, const std::string &message)
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567
STL namespace.
—— Concurrent Priority Queue Implementation ——
Definition: AtomicBitSet.h:29
ResponseBuilder & body(std::unique_ptr< folly::IOBuf > bodyIn)
requires E e noexcept(noexcept(s.error(std::move(e))))
void onUpgrade(proxygen::UpgradeProtocol) noexceptoverride
void onRequest(std::unique_ptr< HTTPMessage >) noexceptoverride
void onBody(std::unique_ptr< folly::IOBuf >) noexceptoverride
std::unique_ptr< IOBuf > copyBuffer(const folly::IOBuf &buf)
std::unique_ptr< folly::IOBuf > body_
const char * string
Definition: Conv.cpp:212
DirectResponseHandler(int code, std::string message, std::string body)
void onError(ProxygenError) noexceptoverride
ResponseHandler * downstream_
void requestComplete() noexceptoverride