summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornicolas.dufresne <nicolas.dufresne@c587cffe-e639-0410-9787-d7902ae8ed56>2011-01-03 21:16:17 +0000
committernicolas.dufresne <nicolas.dufresne@c587cffe-e639-0410-9787-d7902ae8ed56>2011-01-03 21:16:17 +0000
commitbf99c50c03ad6056112f479322877ac1096ba184 (patch)
treef6ed2546d40986654545760fad816d995d67f21f
parent47d308a71cb02191db414a5802bcb7b441865319 (diff)
downloadlibproxy-bf99c50c03ad6056112f479322877ac1096ba184.tar.gz
Avoid using static constructor in shared library
git-svn-id: http://libproxy.googlecode.com/svn/trunk@777 c587cffe-e639-0410-9787-d7902ae8ed56
-rw-r--r--libproxy/modules/config_gnome.cpp4
-rw-r--r--libproxy/url.cpp7
-rw-r--r--libproxy/url.hpp14
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 = "");