XRootD
Loading...
Searching...
No Matches
XrdClHttpOpOptions.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
23
using namespace
XrdClHttp
;
24
25
void
26
CurlOptionsOp::Fail
(uint16_t errCode, uint32_t errNum,
const
std::string &etext) {
27
CurlOperation::Fail
(errCode, errNum, etext);
28
auto
&cache =
VerbsCache::Instance
();
29
cache.Put(
m_url
,
VerbsCache::HttpVerbs
(
VerbsCache::HttpVerb::kUnknown
));
30
// 405 Method Not Supported; indicates that OPTIONS is not understood so
31
// we assume it's highly unlikely that non-HTTP verbs are supported (like
32
// PROPFIND); however, we don't fail the parent operation.
33
//
34
// Since the OPTIONS command is considered advisory, we ignore failures.
35
}
36
37
bool
38
CurlOptionsOp::Setup
(
CURL
*curl,
CurlWorker
&worker) {
39
if
(!
CurlOperation::Setup
(curl, worker))
return
false
;
40
curl_easy_setopt(
m_curl
.get(), CURLOPT_CUSTOMREQUEST,
"OPTIONS"
);
41
curl_easy_setopt(
m_curl
.get(), CURLOPT_NOBODY, 1L);
42
43
return
true
;
44
}
45
46
void
47
CurlOptionsOp::Success
() {
48
auto
&cache =
VerbsCache::Instance
();
49
cache.Put(
m_url
,
m_headers
.GetAllowedVerbs());
50
}
51
52
void
53
CurlOptionsOp::ReleaseHandle
()
54
{
55
if
(
m_curl
==
nullptr
)
return
;
56
curl_easy_setopt(
m_curl
.get(), CURLOPT_CUSTOMREQUEST,
nullptr
);
57
curl_easy_setopt(
m_curl
.get(), CURLOPT_NOBODY, 0L);
58
CurlOperation::ReleaseHandle
();
59
}
XrdClHttpOps.hh
CURL
void CURL
Definition
XrdClHttpUtil.hh:38
XrdClHttp::CurlOperation::m_url
const std::string m_url
Definition
XrdClHttpOps.hh:393
XrdClHttp::CurlOperation::m_curl
std::unique_ptr< CURL, void(*)(CURL *)> m_curl
Definition
XrdClHttpOps.hh:395
XrdClHttp::CurlOperation::RedirectAction::Fail
@ Fail
Definition
XrdClHttpOps.hh:136
XrdClHttp::CurlOperation::ReleaseHandle
virtual void ReleaseHandle()
Definition
XrdClHttpOps.cc:603
XrdClHttp::CurlOperation::m_headers
HeaderParser m_headers
Definition
XrdClHttpOps.hh:396
XrdClHttp::CurlOperation::Setup
virtual bool Setup(CURL *curl, CurlWorker &)
Definition
XrdClHttpOps.cc:523
XrdClHttp::CurlOptionsOp::ReleaseHandle
void ReleaseHandle() override
Definition
XrdClHttpOpOptions.cc:53
XrdClHttp::CurlOptionsOp::Setup
bool Setup(CURL *curl, CurlWorker &) override
Definition
XrdClHttpOpOptions.cc:38
XrdClHttp::CurlOptionsOp::Success
void Success() override
Definition
XrdClHttpOpOptions.cc:47
XrdClHttp::CurlOptionsOp::Fail
void Fail(uint16_t errCode, uint32_t errNum, const std::string &) override
Definition
XrdClHttpOpOptions.cc:26
XrdClHttp::CurlWorker
Definition
XrdClHttpWorker.hh:51
XrdClHttp::VerbsCache::HttpVerbs
Definition
XrdClHttpOptionsCache.hh:46
XrdClHttp::VerbsCache::HttpVerb::kUnknown
@ kUnknown
Definition
XrdClHttpOptionsCache.hh:43
XrdClHttp::VerbsCache::Instance
static VerbsCache & Instance()
Definition
XrdClHttpOptionsCache.cc:37
XrdClHttp
Definition
XrdClHttpChecksum.hh:28
XrdClHttp
XrdClHttpOpOptions.cc
Generated by
1.15.0