Permalink
Browse files

encode post args

  • Loading branch information...
1 parent 5624a6e commit 543a5e7d7489ca5d89a01b3a47f0f26fde23dccb @matteobertozzi committed Jun 22, 2012
Showing with 8 additions and 5 deletions.
  1. +3 −1 skvoz/aggregation/server/service.py
  2. +2 −2 skvoz/util/service.py
  3. +3 −2 skvoz/visualization/server/service.py
@@ -26,6 +26,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from json import dumps as json_dumps
+from base64 import b64decode
from skvoz.aggregation.server import sources
from skvoz.aggregation.server import engine
@@ -37,8 +38,9 @@ class AggregatorRequestHandler(HttpRequestHandler):
@HttpRequestHandler.match("/query$", commands='POST')
def tdql_query(self):
request = dict(self._post_data())
- query = request['query']
+ query = b64decode(request['query'])
+ self.send_headers(200, 'text/plain')
for result in engine.execute_query(self.server.engine, query):
self.wfile.write(json_dumps(result) + '\n')
@@ -86,7 +86,7 @@ def run(self, address, *args, **kwargs):
self.log_message("%s %s is stopping\n" % (self.__class__.__name__, address))
self._stopping(*args, **kwargs)
- self.server.server_close()
+ self.server.shutdown()
if isinstance(address, basestring) and os.path.exists(address):
os.unlink(address)
@@ -127,4 +127,4 @@ def _drop_group_privileges(self):
def log_message(self, message):
sys.stderr.write(message)
- sys.stderr.flush()
+ sys.stderr.flush()
@@ -34,6 +34,7 @@
from skvoz.util.data import DataTable
from json import loads as json_loads
+from base64 import b64encode
import skvoz
@@ -42,8 +43,9 @@
def fetch_data_table(address, query):
table = DataTable()
- for line in http_readlines(address, '/query', {'query': query}):
+ for line in http_readlines(address, '/query', {'query': b64encode(query)}):
ts, data = json_loads(line)
+
if not isinstance(data, dict):
_data = {}
for key, kdata in data:
@@ -55,7 +57,6 @@ def fetch_data_table(address, query):
return table
def _load_and_replace_vars(path, query_vars):
- print query_vars
fd = file(path)
try:
data = fd.read()

0 comments on commit 543a5e7

Please sign in to comment.