From: Marcin Siodelski Date: Mon, 2 Jan 2017 18:35:46 +0000 (+0100) Subject: [5088] Addressed easy review comments. X-Git-Tag: trac5090_base~2^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2bb0efb52ee8198df2e321a7f1729039f19b93ce;p=thirdparty%2Fkea.git [5088] Addressed easy review comments. --- diff --git a/src/lib/http/date_time.cc b/src/lib/http/date_time.cc index 552f1a69b3..0299d863c0 100644 --- a/src/lib/http/date_time.cc +++ b/src/lib/http/date_time.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2016-2017 Internet Systems Consortium, Inc. ("ISC") // // 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 @@ -79,7 +79,6 @@ HttpDateTime::fromAny(const std::string& time_string) { return (date_time); } catch (...) { // Ignore errors, simply try different format. - ; } // Try to parse as a timestamp specified in RFC 850 format. @@ -88,7 +87,6 @@ HttpDateTime::fromAny(const std::string& time_string) { return (date_time); } catch (...) { // Ignore errors, simply try different format. - ; } // Try to parse as a timestamp output by asctime() function. diff --git a/src/lib/http/response.h b/src/lib/http/response.h index 58db85421c..d635706aa2 100644 --- a/src/lib/http/response.h +++ b/src/lib/http/response.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2016-2017 Internet Systems Consortium, Inc. ("ISC") // // 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 @@ -30,7 +30,7 @@ enum class HttpStatusCode : std::uint16_t { OK = 200, CREATED = 201, ACCEPTED = 202, - NO_CONTENT = 203, + NO_CONTENT = 204, MULTIPLE_CHOICES = 300, MOVED_PERMANENTLY = 301, MOVED_TEMPORARILY = 302, diff --git a/src/lib/http/response_creator.h b/src/lib/http/response_creator.h index 4d19838e20..ac4b6f780d 100644 --- a/src/lib/http/response_creator.h +++ b/src/lib/http/response_creator.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2016-2017 Internet Systems Consortium, Inc. ("ISC") // // 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 @@ -22,9 +22,9 @@ namespace http { /// meant to be generic and provide means for transferring different types /// of content, depending on the use case. /// -/// This class specifies a common interface for generating HTTP responses -/// from HTTP requests using specific content type and being used in some -/// specific context. Kea modules providing HTTP services need to +/// This abstract class specifies a common interface for generating HTTP +/// responses from HTTP requests using specific content type and being +/// used in some specific context. Kea modules providing HTTP services need to /// implement their specific derivations of the @ref HttpResponseCreator /// class. These derivations use classes derived from @ref HttpRequest as /// an input and classes derived from @ref HttpResponse as an output of @@ -60,10 +60,15 @@ public: /// @c createDynamicHttpResponse to generate implementation specific /// response to the received request. /// + /// This method is marked virtual final to prevent derived classes from + /// overriding this method. Instead, the derived classes must implement + /// protected methods which this method calls. + /// /// @param request Pointer to an object representing HTTP request. /// @return Pointer to the object encapsulating generated HTTP response. /// @throw HttpResponseError if request is a NULL pointer. - HttpResponsePtr createHttpResponse(const ConstHttpRequestPtr& request); + virtual HttpResponsePtr + createHttpResponse(const ConstHttpRequestPtr& request) final; protected: diff --git a/src/lib/http/response_json.cc b/src/lib/http/response_json.cc index 7df4348d85..fc780ae4cd 100644 --- a/src/lib/http/response_json.cc +++ b/src/lib/http/response_json.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2016-2017 Internet Systems Consortium, Inc. ("ISC") // // 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 @@ -44,7 +44,6 @@ HttpResponseJson::setGenericBody(const HttpStatusCode& status_code) { void HttpResponseJson::setBodyAsJson(const ConstElementPtr& json_body) { - std::ostringstream s; setBody(json_body->str()); }