XRootD
Loading...
Searching...
No Matches
XrdClHttpResponseInfo.hh
Go to the documentation of this file.
1/***************************************************************
2 *
3 * Copyright (C) 2025, Morgridge Institute for Research
4 *
5 ***************************************************************/
6
7#ifndef XRDCLHTTP_CURLRESPONSEINFO_HH
8#define XRDCLHTTP_CURLRESPONSEINFO_HH
9
10#include <memory>
11#include <string>
12#include <unordered_map>
13#include <vector>
14
15namespace XrdClHttp {
16
17// Representation of the information contained in a response.
19public:
20 // Force the response information to be virtual, allowing RTTI and easing potential ABI changes
21 virtual ~ResponseInfo() {};
22
23 // A list of header values in the order they occurred in the response.
24 // Typically, only one element is in the vector.
25 using HeaderValues = std::vector<std::string>;
26
27 // Map of header key to header value(s). The header key is *case sensitive*;
28 // queries should be done using the "canonical" form (see
29 // https://cs.opensource.google/go/go/+/refs/tags/go1.24.2:src/net/textproto/reader.go;l=647)
30 using HeaderMap = std::unordered_map<std::string, HeaderValues>;
31
32 // List of response headers, one entry per response received through the
33 // operation; potentially there are multiple if there was a redirect
34 using HeaderResponses = std::vector<HeaderMap>;
35
36 const HeaderResponses &GetHeaderResponse() const {return m_header_responses;}
37
38 // Adds a set of headers to the internal response object.
39 void AddResponse(HeaderMap &&map) {m_header_responses.emplace_back(map);}
40
41private:
42 std::vector<std::unordered_map<std::string, std::vector<std::string>>> m_header_responses;
43};
44
45} // namespace XrdClHttp
46
47#endif // XRDCLHTTP_CURLRESPONSEINFO_HH
std::vector< std::string > HeaderValues
void AddResponse(HeaderMap &&map)
std::vector< HeaderMap > HeaderResponses
const HeaderResponses & GetHeaderResponse() const
std::unordered_map< std::string, HeaderValues > HeaderMap