/usr/include/leatherman/curl/response.hpp is in libleatherman-dev 1.4.0+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | /**
* @file
* Declares the HTTP response.
*/
#pragma once
#include <string>
#include <functional>
#include <map>
#include "export.h"
namespace leatherman { namespace curl {
/**
* Implements the HTTP response.
*/
struct LEATHERMAN_CURL_EXPORT response
{
/**
* Constructs a HTTP response.
*/
response();
/**
* Adds a header to the response.
* @param name The header name.
* @param value The header value.
*/
void add_header(std::string name, std::string value);
/**
* Enumerates each header in the response.
* @param callback The function to call for each header in the response.
*/
void each_header(std::function<bool(std::string const&, std::string const&)> callback) const;
/**
* Gets a header by name.
* @param name The header name to get.
* @return Returns a pointer to the header's value or nullptr if the header is not present.
*/
const std::string* header(std::string const& name) const;
/**
* Removes a header from the response.
* @param name The name of the header to remove.
*/
void remove_header(std::string const& name);
/**
* Sets the body of the response.
* @param body The body of the response.
*/
void body(std::string body);
/**
* Gets the body of the response.
* @return Returns the body of the response.
*/
std::string const& body() const;
/**
* Sets the status code of the response.
* @param code The status code of the response.
*/
void status_code(int code);
/**
* Gets the status code of the response.
* @return Returns the status code of the response.
*/
int status_code() const;
private:
int _status_code;
std::string _body;
std::map<std::string, std::string> _headers;
};
}} // namespace leatherman::curl
|