mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 08:05:07 +00:00
Libraries: Use default constructors/destructors in LibHTTP
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules "The compiler is more likely to get the default semantics right and you cannot implement these functions better than the compiler."
This commit is contained in:
parent
97fcbdd199
commit
79aa49d04f
6 changed files with 10 additions and 21 deletions
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||||
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -11,14 +12,6 @@
|
||||||
|
|
||||||
namespace HTTP {
|
namespace HTTP {
|
||||||
|
|
||||||
HttpRequest::HttpRequest()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
HttpRequest::~HttpRequest()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
String HttpRequest::method_name() const
|
String HttpRequest::method_name() const
|
||||||
{
|
{
|
||||||
switch (m_method) {
|
switch (m_method) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||||
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -34,8 +35,8 @@ public:
|
||||||
String password;
|
String password;
|
||||||
};
|
};
|
||||||
|
|
||||||
HttpRequest();
|
HttpRequest() = default;
|
||||||
~HttpRequest();
|
~HttpRequest() = default;
|
||||||
|
|
||||||
String const& resource() const { return m_resource; }
|
String const& resource() const { return m_resource; }
|
||||||
Vector<Header> const& headers() const { return m_headers; }
|
Vector<Header> const& headers() const { return m_headers; }
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||||
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -15,10 +16,6 @@ HttpResponse::HttpResponse(int code, HashMap<String, String, CaseInsensitiveStri
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpResponse::~HttpResponse()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
StringView HttpResponse::reason_phrase_for_code(int code)
|
StringView HttpResponse::reason_phrase_for_code(int code)
|
||||||
{
|
{
|
||||||
VERIFY(code >= 100 && code <= 599);
|
VERIFY(code >= 100 && code <= 599);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||||
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -14,7 +15,7 @@ namespace HTTP {
|
||||||
|
|
||||||
class HttpResponse : public Core::NetworkResponse {
|
class HttpResponse : public Core::NetworkResponse {
|
||||||
public:
|
public:
|
||||||
virtual ~HttpResponse() override;
|
virtual ~HttpResponse() override = default;
|
||||||
static NonnullRefPtr<HttpResponse> create(int code, HashMap<String, String, CaseInsensitiveStringTraits>&& headers, size_t downloaded_size)
|
static NonnullRefPtr<HttpResponse> create(int code, HashMap<String, String, CaseInsensitiveStringTraits>&& headers, size_t downloaded_size)
|
||||||
{
|
{
|
||||||
return adopt_ref(*new HttpResponse(code, move(headers), downloaded_size));
|
return adopt_ref(*new HttpResponse(code, move(headers), downloaded_size));
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||||
|
* Copyright (c) 2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -77,10 +78,6 @@ Job::Job(HttpRequest&& request, Core::Stream::Stream& output_stream)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Job::~Job()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Job::start(Core::Stream::Socket& socket)
|
void Job::start(Core::Stream::Socket& socket)
|
||||||
{
|
{
|
||||||
VERIFY(!m_socket);
|
VERIFY(!m_socket);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, the SerenityOS developers.
|
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -21,7 +21,7 @@ class Job : public Core::NetworkJob {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Job(HttpRequest&&, Core::Stream::Stream&);
|
explicit Job(HttpRequest&&, Core::Stream::Stream&);
|
||||||
virtual ~Job() override;
|
virtual ~Job() override = default;
|
||||||
|
|
||||||
virtual void start(Core::Stream::Socket&) override;
|
virtual void start(Core::Stream::Socket&) override;
|
||||||
virtual void shutdown(ShutdownMode) override;
|
virtual void shutdown(ShutdownMode) override;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue