Kea  2.1.7-git
response_creator.cc
Go to the documentation of this file.
1 // Copyright (C) 2016-2020 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #include <config.h>
8 
10 
11 namespace isc {
12 namespace http {
13 
16  // This should never happen. This method must only be called with a
17  // non null request, so we consider it unlikely internal server error.
18  if (!request) {
19  isc_throw(HttpResponseError, "internal server error: HTTP request is null");
20  }
21 
22  // If not finalized, the request parsing failed. Generate HTTP 400.
23  if (!request->isFinalized()) {
25  }
26 
27  // Message has been successfully parsed. Create implementation specific
28  // response to this request.
29  return (createDynamicHttpResponse(request));
30 }
31 
32 }
33 }
virtual HttpResponsePtr createStockHttpResponse(const HttpRequestPtr &request, const HttpStatusCode &status_code) const =0
Creates implementation specific HTTP response.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< HttpResponse > HttpResponsePtr
Pointer to the HttpResponse object.
Definition: response.h:78
Generic exception thrown by HttpResponse class.
Definition: response.h:23
Defines the logger used by the top-level component of kea-lfc.
virtual HttpResponsePtr createDynamicHttpResponse(HttpRequestPtr request)=0
Creates implementation specific HTTP response.
virtual HttpResponsePtr createHttpResponse(HttpRequestPtr request) final
Create HTTP response from HTTP request received.
boost::shared_ptr< HttpRequest > HttpRequestPtr
Pointer to the HttpRequest object.
Definition: request.h:27