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 static void EnableUrlConnectionTraceLogging(); 23 static bool UrlConnectionTraceLoggingEnabled(); 24 25 private: 26 static void _InitUserAgent(); 27 static const BString _GetUserAgentVersionString(); 28 29 static BUrl sBaseUrl; 30 static BString sUserAgent; 31 static pthread_once_t sUserAgentInitOnce; 32 static bool sUrlConnectionTraceLogging; 33 }; 34 35 #endif // SERVER_SETTINGS_H 36