Browse Source

HPCC-17106 Improve roxie handling of query name in REST URL

Signed-off-by: Anthony Fishbeck <anthony.fishbeck@lexisnexis.com>
Anthony Fishbeck 8 years ago
parent
commit
b2598dfaaf
3 changed files with 8 additions and 12 deletions
  1. 0 3
      common/thorhelper/roxiehelper.cpp
  2. 3 0
      roxie/ccd/ccdlistener.cpp
  3. 5 9
      roxie/ccd/ccdprotocol.cpp

+ 0 - 3
common/thorhelper/roxiehelper.cpp

@@ -1553,9 +1553,6 @@ bool CSafeSocket::readBlock(StringBuffer &ret, unsigned timeout, HttpHelper *pHt
                 }
 
                 pHttpHelper->checkTarget();
-                const char *query = pHttpHelper->queryQueryName();
-                if (!query || !*query)
-                    throw MakeStringException(THORHELPER_DATA_ERROR, "HTTP-GET Query not specified");
                 return true;
         }
         else if (strnicmp((char *)&len, "STAT", 4) == 0)

+ 3 - 0
roxie/ccd/ccdlistener.cpp

@@ -1344,6 +1344,9 @@ public:
     }
     virtual void initQuery(StringBuffer &target, const char *name)
     {
+        if (!name || !*name)
+            throw MakeStringException(ROXIE_UNKNOWN_QUERY, "ERROR: Query name not specified");
+
         queryName.set(name);
         queryFactory.setown(globalPackageSetManager->getQuery(name, &target, NULL, *logctx));
         if (!queryFactory)

+ 5 - 9
roxie/ccd/ccdprotocol.cpp

@@ -1364,15 +1364,11 @@ public:
     }
     void extractName(HttpHelper &httpHelper, const char *msg, const IContextLogger &logctx, const char *peer, unsigned port)
     {
-        StringAttr urlName;
-        if (httpHelper.queryQueryName()) //"Adaptive REST" query name and attrs can come from URL
+        const char *urlName = httpHelper.queryQueryName(); //"Adaptive REST" query name and attrs can come from URL
+        if (httpHelper.isHttpGet() || httpHelper.isMappedToInputParameter()) //these types can't have roxie attrs in the content body
         {
-            urlName.set(httpHelper.queryQueryName());
-            if (httpHelper.isMappedToInputParameter()) //this type of content can't have roxie level attrs in
-            {
-                name.set(urlName);
-                return;
-            }
+            name.set(urlName); //if blank will return error as expected
+            return;
         }
 
         Owned<IPullPTreeReader> parser;
@@ -1383,7 +1379,7 @@ public:
         if (!parser)
             return;
         while (more && parser->next());
-        if (urlName.length())
+        if (urlName && *urlName)
         {
             name.set(urlName);
             return;