This file is indexed.

/usr/include/musicbrainz3/webservice.h is in libmusicbrainz3-dev 3.0.2-2.5.

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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
/*
 * MusicBrainz -- The Internet music metadatabase
 *
 * Copyright (C) 2006 Lukas Lalinsky
 *  
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * $Id: webservice.h 8470 2006-09-05 14:06:16Z luks $
 */
 
#ifndef __MUSICBRAINZ3_WEBSERVICE_H__
#define __MUSICBRAINZ3_WEBSERVICE_H__

#include <string>
#include <musicbrainz3/musicbrainz.h> 
#include <musicbrainz3/iwebservice.h>

namespace MusicBrainz
{
  
	/**
	 * A web service error has occurred.
	 * 
	 * This is the base class for several other web service related
	 * exceptions.
	 */
	class MB_API WebServiceError : public Exception
	{
	public:
		WebServiceError(const std::string &msg = std::string()) : Exception(msg) {}
	};
	
	/**
	 * Getting a server connection failed.
	 *
	 * This exception is mostly used if the client couldn't connect to
	 * the server because of an invalid host name or port. It doesn't
	 * make sense if the web service in question doesn't use the network. 
	 */
	class MB_API ConnectionError : public WebServiceError
	{
	public:
		ConnectionError(const std::string &msg = std::string()) : WebServiceError(msg) {}
	};
	
	/**
	 * Connection to a server timed out.
	 *
	 */
	class MB_API TimeOutError : public WebServiceError
	{
	public:
		TimeOutError(const std::string &msg = std::string()) : WebServiceError(msg) {}
	};
	
	/**
	 * No resource with the given ID exists.
	 */
	class MB_API ResourceNotFoundError : public WebServiceError
	{
	public:
		ResourceNotFoundError(const std::string &msg = std::string()) : WebServiceError(msg) {}
	};
	
	/**
	 * Authentication failed.
	 *
	 * This is thrown if user name, password or realm were invalid while
	 * trying to access a protected resource. 
	 */
	class MB_API AuthenticationError : public WebServiceError
	{
	public:
		AuthenticationError(const std::string &msg = std::string()) : WebServiceError(msg) {}
	};
	
	/**
	 * The returned resource was invalid.
	 *
	 * This may be due to a malformed XML document or if the requested
	 * data wasn't part of the response. It can only occur in case of
	 * bugs in the web service itself. 
	 */
	class MB_API ResponseError : public WebServiceError
	{
	public:
		ResponseError(const std::string &msg = std::string()) : WebServiceError(msg) {}
	};
	
	/**
	 * An invalid request was made.
	 *
	 * This exception is raised if the client made an invalid request.
	 * That could be syntactically invalid identifiers or unknown or
	 * invalid parameter values. 
	 */
	class MB_API RequestError : public WebServiceError
	{
	public:
		RequestError(const std::string &msg = std::string()) : WebServiceError(msg) {}
	};
	
	/**
	 * An interface to the MusicBrainz XML web service via HTTP.
	 *
	 * By default, this class uses the MusicBrainz server but may be
	 * configured for accessing other servers as well using the
	 * constructor (WebService::WebService). This implements IWebService, so
	 * additional documentation on method parameters can be found there.
	 */
	
	class MB_API WebService : public IWebService
	{
	public:
	
		/**
		 * Constructor.
		 * 
		 * This can be used without parameters. In this case, the
		 * MusicBrainz server will be used.
		 *
		 * @param host a string containing a host name
		 * @param port an integer containing a port number
		 * @param pathPrefix a string prepended to all URLs
		 * @param username a string containing a MusicBrainz user name
		 * @param password a string containing the user's password
		 * @param realm a string containing the realm used for authentication
		 */
		WebService(const std::string &host = "musicbrainz.org",
				   const int port = 80,
				   const std::string &pathPrefix = "/ws",
				   const std::string &username = std::string(),
				   const std::string &password = std::string(),
				   const std::string &realm = "musicbrainz.org");

		/**
		 * Destructor.
		 */
		virtual ~WebService();
		
		/**
		 * Sets the host. 
		 *
		 * @param host a string containing the host name   
		 */
		void setHost(const std::string &host);
		
		/**
		 * Returns the host.
		 *
		 * @return a string containing the host name  
		 */
		std::string getHost() const;
		
		/**
		 * Sets the port. 
		 *
		 * @param port an int containing the port number   
		 */
		void setPort(const int port);
		
		/**
		 * Returns the port.
		 *
		 * @return an int containing the port number  
		 */
		int getPort() const;
		
		/**
		 * Sets the path prefix. 
		 *
		 * @param pathPrefix a string containing the path prefix  
		 */
		void setPathPrefix(const std::string &pathPrefix);
		
		/**
		 * Returns the path prefix.
		 *
		 * @return a string containing the path prefix  
		 */
		std::string getPathPrefix() const;
		
		/**
		 * Sets the MusicBrainz user name. 
		 *
		 * @param username a string containing the user name  
		 */
		void setUserName(const std::string &username);
		
		/**
		 * Returns the MusicBrainz user name.
		 *
		 * @return a string containing the user name 
		 */
		std::string getUserName() const;
		
		/**
		 * Sets the MusicBrainz user password. 
		 *
		 * @param password a string containing the user password  
		 */
		void setPassword(const std::string &password);
		
		/**
		 * Returns the MusicBrainz user password.
		 *
		 * @return a string containing the user password 
		 */
		std::string getPassword() const;
		
		/**
		 * Sets the HTTP authentification realm. 
		 *
		 * @param realm a string containing the realm 
		 */
		void setRealm(const std::string &realm);
		
		/**
		 * Returns the HTTP authentification realm.
		 *
		 * @return a string containing the realm 
		 */
		std::string getRealm() const;
		
		/**
		 * Sets the proxy host. 
		 *
		 * @param host a string containing the host name   
		 */
		void setProxyHost(const std::string &host);
		
		/**
		 * Returns the proxy host.
		 *
		 * @return a string containing the host name  
		 */
		std::string getProxyHost() const;
		
		/**
		 * Sets the proxy port. 
		 *
		 * @param port an int containing the port number   
		 */
		void setProxyPort(const int port);
		
		/**
		 * Returns the proxy port.
		 *
		 * @return an int containing the port number  
		 */
		int getProxyPort() const;
		
		/**
		 * Sets the proxy user name. 
		 *
		 * @param username a string containing the user name   
		 */
		void setProxyUserName(const std::string &username);
		
		/**
		 * Returns the proxy user name.
		 *
		 * @return a string containing the user name  
		 */
		std::string getProxyUserName() const;
		
		/**
		 * Sets the proxy password. 
		 *
		 * @param password a string containing the password   
		 */
		void setProxyPassword(const std::string &password);
		
		/**
		 * Returns the proxy password.
		 *
		 * @return a string containing the password  
		 */
		std::string getProxyPassword() const;
		
		/**
		 * Query the web service via HTTP-GET.
		 *
		 * Returns a string containing the result or raises a
		 * WebServiceError. Conditions leading to errors may be
		 * invalid entities, IDs, \a include or \a filter parameters
		 * and unsupported version numbers.
		 *
		 * @throw ConnectionError couldn't connect to server
		 * @throw RequestError invalid IDs or parameters
		 * @throw AuthenticationError invalid user name and/or password
		 * @throw ResourceNotFoundError resource doesn't exist
		 * 
		 * @see IWebService::get  		 
		 */
		std::string get(const std::string &entity,
						const std::string &id,
						const IIncludes::IncludeList &include,
						const IFilter::ParameterList &filter,
						const std::string &version = "1"); 

		/**
		 * Send data to the web service via HTTP-POST.
		 *
		 * Note that this may require authentication. You can set
		 * user name, password and realm in the constructor
		 * (WebService::WebService).
		 * 
		 * @throw ConnectionError couldn't connect to server
		 * @throw RequestError invalid IDs or parameters
		 * @throw AuthenticationError invalid user name and/or password
		 * @throw ResourceNotFoundError resource doesn't exist
		 * 
		 * @see IWebService::post 
		 */		 
		 void post(const std::string &entity,
				   const std::string &id,
				   const std::string &data,
				   const std::string &version = "1");
		
	private:
	
		static int httpAuth(void *userdata, const char *realm, int attempts,
							char *username, char *password);
		static int proxyAuth(void *userdata, const char *realm, int attempts,
							char *username, char *password);
		static int httpResponseReader(void *userdata, const char *buf, size_t len);

		class WebServicePrivate;
		WebServicePrivate *d;
	};
	
}

#endif