From bf99c50c03ad6056112f479322877ac1096ba184 Mon Sep 17 00:00:00 2001 From: "nicolas.dufresne" Date: Mon, 3 Jan 2011 21:16:17 +0000 Subject: Avoid using static constructor in shared library git-svn-id: http://libproxy.googlecode.com/svn/trunk@777 c587cffe-e639-0410-9787-d7902ae8ed56 --- libproxy/modules/config_gnome.cpp | 4 ++-- libproxy/url.cpp | 7 ------- libproxy/url.hpp | 14 +++++++------- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/libproxy/modules/config_gnome.cpp b/libproxy/modules/config_gnome.cpp index ec5e2b3..1599e62 100644 --- a/libproxy/modules/config_gnome.cpp +++ b/libproxy/modules/config_gnome.cpp @@ -192,8 +192,8 @@ public: else if (this->data[PROXY_MODE] == "manual") { string type, host, port; bool auth = this->data[PROXY_USE_AUTHENTICATION] == "true"; - string username = url::encode(this->data[PROXY_AUTH_USER], url::ALLOWED_IN_USERINFO_ELEMENT); - string password = url::encode(this->data[PROXY_AUTH_PASSWORD], url::ALLOWED_IN_USERINFO_ELEMENT); + string username = url::encode(this->data[PROXY_AUTH_USER], URL_ALLOWED_IN_USERINFO_ELEMENT); + string password = url::encode(this->data[PROXY_AUTH_PASSWORD], URL_ALLOWED_IN_USERINFO_ELEMENT); bool same_proxy = this->data[PROXY_SAME_FOR_ALL] == "true"; // If socks is set use it (except when same_proxy is set) diff --git a/libproxy/url.cpp b/libproxy/url.cpp index ea9fc8b..484a4dd 100644 --- a/libproxy/url.cpp +++ b/libproxy/url.cpp @@ -56,13 +56,6 @@ using namespace std; // This is the maximum pac size (to avoid memory attacks) #define PAC_MAX_SIZE 102400 -const string url::GENERIC_DELIMITERS(":/?#[]@"); -const string url::SUBCOMPONENT_DELIMITERS("!$&'()*+,;="); -const string url::ALLOWED_IN_USERINFO_ELEMENT(url::SUBCOMPONENT_DELIMITERS); -const string url::ALLOWED_IN_USERINFO(url::ALLOWED_IN_USERINFO_ELEMENT + ":"); -const string url::ALLOWED_IN_PATH_ELEMENT(url::SUBCOMPONENT_DELIMITERS + ":@"); -const string url::ALLOWED_IN_PATH(url::ALLOWED_IN_PATH_ELEMENT + "/"); - static inline int get_default_port(string scheme) { struct servent *serv; size_t plus = scheme.find('+'); diff --git a/libproxy/url.hpp b/libproxy/url.hpp index c96979c..2fd6c34 100644 --- a/libproxy/url.hpp +++ b/libproxy/url.hpp @@ -27,6 +27,13 @@ #include "config.hpp" +#define URL_GENERIC_DELIMITERS ":/?#[]@" +#define URL_SUBCOMPONENT_DELIMITERS "!$&'()*+,;=" +#define URL_ALLOWED_IN_USERINFO_ELEMENT URL_SUBCOMPONENT_DELIMITERS +#define URL_ALLOWED_IN_USERINFO URL_ALLOWED_IN_USERINFO_ELEMENT ":" +#define URL_ALLOWED_IN_PATH_ELEMENT URL_SUBCOMPONENT_DELIMITERS ":@" +#define URL_ALLOWED_IN_PATH URL_ALLOWED_IN_PATH_ELEMENT "/" + namespace libproxy { using namespace std; @@ -38,13 +45,6 @@ public: class DLL_PUBLIC url { public: - static const string ALLOWED_IN_PATH; - static const string ALLOWED_IN_PATH_ELEMENT; - static const string ALLOWED_IN_USERINFO; - static const string ALLOWED_IN_USERINFO_ELEMENT; - static const string GENERIC_DELIMITERS; - static const string SUBCOMPONENT_DELIMITERS; - static bool is_valid(const string url); static string encode(const string &data, const string &valid_reserved = ""); -- cgit v1.2.1