xref: /haiku/src/apps/haikudepot/server/ServerSettings.h (revision c0936b5a0384bc6fe654d296ee54222a0f45d2b6)
1 /*
2  * Copyright 2017, Andrew Lindesay <apl@lindesay.co.nz>.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 
6 #ifndef SERVER_SETTINGS_H
7 #define SERVER_SETTINGS_H
8 
9 #include <File.h>
10 #include <HttpHeaders.h>
11 #include <String.h>
12 #include <Url.h>
13 
14 
15 class ServerSettings {
16 public:
17 		static status_t					SetBaseUrl(const BUrl& baseUrl);
18 		static const BString			GetUserAgent();
19 		static void						AugmentHeaders(BHttpHeaders& headers);
20 		static BUrl						CreateFullUrl(
21 											const BString urlPathComponents);
22 
23 		static bool						PreferCache();
24 		static void						SetPreferCache(bool value);
25 		static bool						DropCache();
26 		static void						SetDropCache(bool value);
27 		static bool						ForceNoNetwork();
28 		static void						SetForceNoNetwork(bool value);
29 
30 private:
31 		static void						_InitUserAgent();
32 		static const BString			_GetUserAgentVersionString();
33 
34 		static BUrl						sBaseUrl;
35 		static BString					sUserAgent;
36 		static pthread_once_t			sUserAgentInitOnce;
37 		static bool						sPreferCache;
38 		static bool						sDropCache;
39 		static bool						sForceNoNetwork;
40 };
41 
42 #endif // SERVER_SETTINGS_H
43