Commit 5cf6032c authored by Max Kellermann's avatar Max Kellermann Committed by Max Kellermann

lib/curl/Request: move code to SetupEasy()

parent 8d8b7741
/* /*
* Copyright 2008-2018 Max Kellermann <max.kellermann@gmail.com> * Copyright 2008-2021 Max Kellermann <max.kellermann@gmail.com>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
...@@ -49,6 +49,17 @@ CurlRequest::CurlRequest(CurlGlobal &_global, ...@@ -49,6 +49,17 @@ CurlRequest::CurlRequest(CurlGlobal &_global,
CurlResponseHandler &_handler) CurlResponseHandler &_handler)
:global(_global), handler(_handler) :global(_global), handler(_handler)
{ {
SetupEasy();
}
CurlRequest::~CurlRequest() noexcept
{
FreeEasy();
}
void
CurlRequest::SetupEasy()
{
error_buffer[0] = 0; error_buffer[0] = 0;
easy.SetPrivate((void *)this); easy.SetPrivate((void *)this);
...@@ -65,11 +76,6 @@ CurlRequest::CurlRequest(CurlGlobal &_global, ...@@ -65,11 +76,6 @@ CurlRequest::CurlRequest(CurlGlobal &_global,
easy.SetOption(CURLOPT_HTTPAUTH, (long) CURLAUTH_ANY); easy.SetOption(CURLOPT_HTTPAUTH, (long) CURLAUTH_ANY);
} }
CurlRequest::~CurlRequest() noexcept
{
FreeEasy();
}
void void
CurlRequest::Start() CurlRequest::Start()
{ {
......
...@@ -154,6 +154,8 @@ public: ...@@ -154,6 +154,8 @@ public:
void Done(CURLcode result) noexcept; void Done(CURLcode result) noexcept;
private: private:
void SetupEasy();
/** /**
* Frees the current "libcurl easy" handle, and everything * Frees the current "libcurl easy" handle, and everything
* associated with it. * associated with it.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment