/usr/include/Wt/Http/Message is in libwt-dev 3.3.6+dfsg-1.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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | // This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2009 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef WT_HTTP_MESSAGE_H_
#define WT_HTTP_MESSAGE_H_
#include <Wt/WStringStream>
namespace Wt {
namespace Http {
/*! \class Message Wt/Http/Message Wt/Http/Message
* \brief An HTTP client message (request or response).
*
* This class implements a message that is sent or received by the
* HTTP Client.
*
* It is not to be confused with Request and Response, which are
* involved in the web application server handling.
*
* \ingroup http
*/
class WT_API Message
{
public:
/*! \class Header
* \brief An HTTP message header.
*
* An HTTP message header is a name/value pair, as defined by RFC 822.
*/
class WT_API Header
{
public:
/*! \brief Default constructor.
*/
Header();
/*! \brief Constructs a header with a given name and value.
*/
Header(const std::string& name, const std::string& value);
/*! \brief Copy constructor.
*/
Header(const Header& other);
/*! \brief Sets the header name.
*/
void setName(const std::string& name);
/*! \brief Returns the header name.
*
* \sa setName()
*/
const std::string& name() const { return name_; }
/*! \brief Sets the header value.
*/
void setValue(const std::string& value);
/*! \brief Returns the header value.
*
* \sa setValue()
*/
const std::string& value() const { return value_; }
private:
std::string name_, value_;
};
/*! \brief Constructor.
*
* This creates an empty message, with an invalid status (-1), no headers
* and an empty body.
*/
Message();
/*! \brief Constructor.
*
* This creates an empty message, with an invalid status (-1), an empty body
* and the given headers.
*/
Message(std::vector<Header> headers);
/*! \brief Copy constructor.
*/
Message(const Message& message);
/*! \brief Sets the status code.
*
* \note This method is probably not useful to you, since for a request
* it is ignored, and for a response it is set by the client.
*/
void setStatus(int status);
/*! \brief Returns the status code.
*
* This returns the HTTP status code of a response message. Typical values
* are 200 (OK) or 404 (Not found).
*/
int status() const { return status_; }
/*! \brief Sets a header value.
*
* If a header with that value was already defined, it is replaced with
* the new value. Otherwise, the header is added.
*
* \sa addHeader()
*/
void setHeader(const std::string& name, const std::string& value);
/*! \brief Adds a header value.
*
* A header is added, even if a header with the same name already
* was present. This is allowed by HTTP only for certain headers
* (e.g. Set-Cookie).
*
* \sa setHeader()
*/
void addHeader(const std::string& name, const std::string& value);
/*! \brief Returns the headers.
*/
const std::vector<Header>& headers() const { return headers_; }
/*! \brief Returns a header value.
*
* Returns 0 if no header with that name is found.
*/
const std::string *getHeader(const std::string& name) const;
/*! \brief Concatenates body text.
*
* Adds the \p text to the message body.
*/
void addBodyText(const std::string& text);
/*! \brief Returns the body text.
*
* Returns the body text.
*/
std::string body() const;
private:
int status_;
std::vector<Header> headers_;
WStringStream body_;
friend class Client;
};
}
}
#endif // WT_HTTP_MESSAGE_H_
|