THRIFT-721. py: THttpClient ignores url parameters

Respect query string in THttpClient and generated remotes. Also, add an error message on unknown methods.

Patch: Thomas Kho

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@991786 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/generate/t_py_generator.cc b/compiler/cpp/src/generate/t_py_generator.cc
index 725573a..891ba30 100644
--- a/compiler/cpp/src/generate/t_py_generator.cc
+++ b/compiler/cpp/src/generate/t_py_generator.cc
@@ -1352,6 +1352,8 @@
     "  else:" << endl <<
     "    port = 80" << endl <<
     "  uri = url[2]" << endl <<
+    "  if url[4]:" << endl <<
+    "    uri += '?%s' % url[4]" << endl <<
     "  http = True" << endl <<
     "  argi += 2" << endl <<
     endl <<
@@ -1407,6 +1409,10 @@
 
     f_remote << endl;
   }
+  f_remote << "else:" << endl;
+  f_remote << "  print 'Unrecognized method %s' % cmd" << endl;
+  f_remote << "  sys.exit(1)" << endl;
+  f_remote << endl;
 
   f_remote << "transport.close()" << endl;
 
diff --git a/lib/py/src/transport/THttpClient.py b/lib/py/src/transport/THttpClient.py
index 05ca53a..5026978 100644
--- a/lib/py/src/transport/THttpClient.py
+++ b/lib/py/src/transport/THttpClient.py
@@ -54,6 +54,8 @@
         self.port = parsed.port or httplib.HTTPS_PORT
       self.host = parsed.hostname
       self.path = parsed.path
+      if parsed.query:
+        self.path += '?%s' % parsed.query
     self.__wbuf = StringIO()
     self.__http = None
     self.__timeout = None