XRootD
Loading...
Searching...
No Matches
XrdClHttpOpDelete.cc
Go to the documentation of this file.
1/******************************************************************************/
2/* Copyright (C) 2025, Pelican Project, Morgridge Institute for Research */
3/* */
4/* This file is part of the XrdClHttp client plugin for XRootD. */
5/* */
6/* XRootD is free software: you can redistribute it and/or modify it under */
7/* the terms of the GNU Lesser General Public License as published by the */
8/* Free Software Foundation, either version 3 of the License, or (at your */
9/* option) any later version. */
10/* */
11/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
12/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
13/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
14/* License for more details. */
15/* */
16/* The copyright holder's institutional names and contributor's names may not */
17/* be used to endorse or promote products derived from this software without */
18/* specific prior written permission of the institution or contributor. */
19/******************************************************************************/
20
21#include "XrdClHttpOps.hh"
22#include "XrdClHttpResponses.hh"
23
24#include <XrdCl/XrdClLog.hh>
25
26using namespace XrdClHttp;
27
28CurlDeleteOp::CurlDeleteOp(XrdCl::ResponseHandler *handler, const std::string &url,
29 struct timespec timeout, XrdCl::Log *logger,
30 bool response_info, CreateConnCalloutType callout,
31 HeaderCallout *header_callout)
32 : CurlOperation(handler, url, timeout, logger, callout, header_callout)
33{}
34
36
37void
39 if (m_curl == nullptr) return;
40 curl_easy_setopt(m_curl.get(), CURLOPT_CUSTOMREQUEST, nullptr);
42}
43
44bool
46 if (!CurlOperation::Setup(curl, worker)) return false;
47 curl_easy_setopt(m_curl.get(), CURLOPT_CUSTOMREQUEST, "DELETE");
48
49 return true;
50}
51
52void
54 SetDone(false);
55 m_logger->Debug(kLogXrdClHttp, "CurlDeleteOp::Success");
56 if (m_handler == nullptr) {return;}
57
58 XrdCl::AnyObject *obj{nullptr};
59 if (m_response_info) {
60 auto info = new XrdClHttp::DeleteResponseInfo();
61 info->SetResponseInfo(MoveResponseInfo());
62 obj = new XrdCl::AnyObject();
63 obj->Set(info);
64 }
65
66 auto handle = m_handler;
67 m_handler = nullptr;
68 handle->HandleResponse(new XrdCl::XRootDStatus(), obj);
69}
void CURL
bool Setup(CURL *curl, CurlWorker &) override
CurlDeleteOp(XrdCl::ResponseHandler *handler, const std::string &url, struct timespec timeout, XrdCl::Log *logger, bool response_info, CreateConnCalloutType callout, HeaderCallout *header_callout)
void SetDone(bool has_failed)
std::unique_ptr< ResponseInfo > MoveResponseInfo()
std::unique_ptr< CURL, void(*)(CURL *)> m_curl
virtual void ReleaseHandle()
XrdCl::ResponseHandler * m_handler
CurlOperation(XrdCl::ResponseHandler *handler, const std::string &url, struct timespec timeout, XrdCl::Log *log, CreateConnCalloutType, HeaderCallout *header_callout)
virtual bool Setup(CURL *curl, CurlWorker &)
void Set(Type object, bool own=true)
Handle diagnostics.
Definition XrdClLog.hh:101
Handle an async response.
ConnectionCallout *(*)(const std::string &, const ResponseInfo &) CreateConnCalloutType
const uint64_t kLogXrdClHttp