src/server/daemon/httprequest.c

changeset 495
855a915472ff
parent 460
b9a447b02046
child 531
9b15b1f72bef
--- a/src/server/daemon/httprequest.c	Wed May 31 12:43:30 2023 +0200
+++ b/src/server/daemon/httprequest.c	Wed May 31 12:49:44 2023 +0200
@@ -252,11 +252,12 @@
         return 1;
     }
     
-    cxmutstr query;
-    query.length = 0;
-    
     for(int i=0;i<request->uri.length;i++) {
         if(request->uri.ptr[i] == '?') {
+            cxmutstr query;
+            query.ptr = NULL;
+            query.length = 0;
+            
             /* split uri in path and query */
             if(absPath.length > i + 2) {
                 query.length = absPath.length - i - 1;
@@ -265,11 +266,13 @@
             absPath.length = i;
 
             // Pass any query as 'query' in reqpb
-            pblock_kvinsert(
+            if(query.length > 0) {
+                pblock_kvinsert(
                     pb_key_query,
                     query.ptr,
                     query.length,
                     rq->rq.reqpb);
+            }
 
             break;
         }

mercurial