This file is indexed.

/usr/include/ui-utilcpp/http/Cookie.hpp is in libui-utilcpp-dev 1.8.5-1+b2.

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
/**
 * @file
 */
#ifndef UI_UTIL_HTTP_COOKIE_HPP
#define UI_UTIL_HTTP_COOKIE_HPP

// STDC
#include <ctime>

// STDC++
#include <string>
#include <vector>

// C++ libraries
#include <ui-utilcpp/http/Header.hpp>

namespace UI {
namespace Util {
namespace Http {

/** @todo Parts marked "GENERIC PART" should be solved by a generic key/pair vector. */

class Cookie: private std::pair<std::string, std::string>
{
public:
	Cookie(std::string const & name, std::string const & value);
	std::string const & getName()  const;
	std::string const & getValue() const;
};

/** @brief Handle "Cookie" request header field values syntactically.
 *
 * @note Wording <em>line</em> means a string in "Cookie" header field
 * value syntax ("a=b;c=d;e=f") as described
 * http://wp.netscape.com/newsref/std/cookie_spec.html .
 */
class Cookies: public std::vector<Cookie>
{
public:
	Cookies(std::string const & line="", std::string const & prefix="");
	Cookies(HeaderField const & field, std::string const & prefix="");
	Cookies(Header const & header, std::string const & prefix="");

	/** @name Modifiers (add cookies).
	 *  @{ */
	Cookies & add(std::string const & name, std::string const & value);
	Cookies & addLine(std::string const & line, std::string const & prefix="");
	Cookies & add(Header const & header, std::string const & prefix="");
	/** @} */

	/** @name Accessors.
	 *  @{ */
	// GENERIC PART
	const_iterator find(std::string const & name) const;
	bool exists(std::string const & name) const;
	std::string const & get(std::string const & name, bool doThrow=true) const;
	// END GENERIC PART
	std::string getLine(std::string const & prefix="") const;
	/** @} */
};

/** @brief Handle "SetCookie" request header field values syntactically.
 *
 * @note Wording <em>line</em> means a string in "SetCookie" header
 * field value syntax ("NAME=a;expires=b;path=c;...") as described
 * http://wp.netscape.com/newsref/std/cookie_spec.html .
 *
 * @todo Syntax integrity checks for setVALUE methods (expires, domain, path, ...).
 */
class SetCookie
{
public:
	SetCookie(HeaderField const & field);
	SetCookie(std::string const & name, std::string const & value="");

	/** @name Modifiers (set values).
	 *  @{ */
	SetCookie & setName(std::string const & name);
	SetCookie & setValue(std::string const & value);
	SetCookie & setExpires(std::string const & expires="Tue, 01-Jan-1980 00:00:00 GMT");
	SetCookie & setExpires(time_t const timestamp);
	SetCookie & setPath(std::string const & path);
	SetCookie & setDomain(std::string const & domain);
	SetCookie & setSecure(bool const & secure=true);

	/** @brief This resets all values and sets the values in line. */
	SetCookie & setLine(std::string const & line);
	/** @} */

	/** @name Accessors. */
	/** @{ */
	std::string const & getName()    const;
	std::string const & getValue()   const;
	std::string const & getExpires() const;
	std::string const & getPath()    const;
	std::string const & getDomain()  const;
	/** @} */

private:
	void addTok(std::string & line, std::string const & name, std::string const & value) const;
	void addTokDef(std::string & line, std::string const & name, std::string const & value, std::string const & defaultValue) const;

public:
	/** @brief Composition. */
	std::string getLine(std::string const & prefix="",
	                    std::string const & expiresDefault="",
	                    std::string const & pathDefault="",
	                    std::string const & domainDefault="") const;

private:
	std::string name_;
	std::string value_;
	std::string expires_;
	std::string path_;
	std::string domain_;
	bool secure_;
};


/** @brief Handle a vector of SetCookie's. */
class SetCookies: public std::vector<SetCookie>
{
public:
	SetCookies();
	SetCookies(Header const & header);

	SetCookie & add(std::string const & name, std::string const & value="");

	/** @name Accessors. */
	/** @{ */
	// GENERIC PART
	const_iterator find(std::string const & name) const;
	bool exists(std::string const & name) const;
	SetCookie const & get(std::string const & name) const;
	// END GENERIC PART

	Header getHeader(std::string const & prefix="",
	                 std::string const & expiresDefault="",
	                 std::string const & pathDefault="",
	                 std::string const & domainDefault="") const;
	/** @} */
};

}}}
#endif