]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5088] Addressed easy review comments.
authorMarcin Siodelski <marcin@isc.org>
Mon, 2 Jan 2017 18:35:46 +0000 (19:35 +0100)
committerMarcin Siodelski <marcin@isc.org>
Mon, 2 Jan 2017 18:52:39 +0000 (19:52 +0100)
src/lib/http/date_time.cc
src/lib/http/response.h
src/lib/http/response_creator.h
src/lib/http/response_json.cc

index 552f1a69b3f7e8c844e779ea06120e8afdfce9b9..0299d863c099091353aa1dbbcb0344e77e91e04b 100644 (file)
@@ -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.
index 58db85421c441ccec4504a55d0469e5452088a50..d635706aa21fa9d16f546ec4a17e2aa30d725682 100644 (file)
@@ -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,
index 4d19838e20782f97287e8f28d9aaba27e00815c1..ac4b6f780da88de902fdcd28383c583f55855099 100644 (file)
@@ -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:
 
index 7df4348d8540dcd94b4150e7f8da755ebbc7f754..fc780ae4cd7e656ddaad372253b40e479a4be3be 100644 (file)
@@ -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());
 }