From f7346c1d788582b2450f9f3e46dda8cec6540db5 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 7 Dec 2021 11:56:52 +0100 Subject: [PATCH] lib/curl/Request: move code to SetupEasy() --- src/lib/curl/Request.cxx | 18 ++++++++++++------ src/lib/curl/Request.hxx | 2 ++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/lib/curl/Request.cxx b/src/lib/curl/Request.cxx index de97f1555..45dd440ec 100644 --- a/src/lib/curl/Request.cxx +++ b/src/lib/curl/Request.cxx @@ -1,5 +1,5 @@ /* - * Copyright 2008-2018 Max Kellermann + * Copyright 2008-2021 Max Kellermann * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -48,6 +48,17 @@ CurlRequest::CurlRequest(CurlGlobal &_global, CurlResponseHandler &_handler) :global(_global), handler(_handler) +{ + SetupEasy(); +} + +CurlRequest::~CurlRequest() noexcept +{ + FreeEasy(); +} + +void +CurlRequest::SetupEasy() { error_buffer[0] = 0; @@ -65,11 +76,6 @@ CurlRequest::CurlRequest(CurlGlobal &_global, easy.SetOption(CURLOPT_HTTPAUTH, (long) CURLAUTH_ANY); } -CurlRequest::~CurlRequest() noexcept -{ - FreeEasy(); -} - void CurlRequest::Start() { diff --git a/src/lib/curl/Request.hxx b/src/lib/curl/Request.hxx index d18e06c4f..a43b29bf9 100644 --- a/src/lib/curl/Request.hxx +++ b/src/lib/curl/Request.hxx @@ -154,6 +154,8 @@ public: void Done(CURLcode result) noexcept; private: + void SetupEasy(); + /** * Frees the current "libcurl easy" handle, and everything * associated with it.