示例#1
0
HTTPTransactionHandler* SimpleController::getTransactionTimeoutHandler(
    HTTPTransaction* txn,
    const folly::SocketAddress& localAddress) {

  auto errorPage = acceptor_->getErrorPage(localAddress);
  return createErrorHandler(408, "Client timeout", errorPage);
}
示例#2
0
HTTPTransactionHandler* SimpleController::getParseErrorHandler(
    HTTPTransaction* /*txn*/,
    const HTTPException& error,
    const folly::SocketAddress& localAddress) {

  if (error.hasCodecStatusCode()) {
    return new CodecErrorResponseHandler(error.getCodecStatusCode());
  }

  auto errorPage = acceptor_->getErrorPage(localAddress);
  return createErrorHandler(error.hasHttpStatusCode() ?
                            error.getHttpStatusCode() : 400,
                            "Bad Request", errorPage);
}