session_shared: only reuse sets with matching db
[metaproxy-moved-to-github.git] / src / util.cpp
index 1f335a1..ea6c931 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of Metaproxy.
-   Copyright (C) 2005-2011 Index Data
+   Copyright (C) 2005-2012 Index Data
 
 Metaproxy is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free
@@ -690,9 +690,21 @@ std::string mp_util::uri_encode(std::string s)
     char *x = (char *) xmalloc(1 + s.length() * 3);
     yaz_encode_uri_component(x, s.c_str());
     std::string result(x);
+    xfree(x);
     return result;
 }
 
+
+std::string mp_util::uri_decode(std::string s)
+{
+    char *x = (char *) xmalloc(1 + s.length());
+    yaz_decode_uri_component(x, s.c_str(), s.length());
+    std::string result(x);
+    xfree(x);
+    return result;
+}
+
+
 /*
  * Local variables:
  * c-basic-offset: 4