better way to do the query string
authorJim Morris <morris@wolfman.com>
Fri, 7 Sep 2018 13:31:37 +0000 (14:31 +0100)
committerJim Morris <morris@wolfman.com>
Fri, 7 Sep 2018 13:31:37 +0000 (14:31 +0100)
src/libs/Network/uip/webserver/httpd.c

index 4bdaa5b..7db3d53 100644 (file)
@@ -319,6 +319,7 @@ static PT_THREAD(send_headers(struct httpd_state *s, const char *statushdr))
 static
 PT_THREAD(handle_output(struct httpd_state *s))
 {
+    const char *str= NULL;
     PT_BEGIN(&s->outputpt);
 
     if (s->method == OPTIONS) {
@@ -359,7 +360,8 @@ PT_THREAD(handle_output(struct httpd_state *s))
 
         if (strcmp(s->filename, "/query") == 0) { // query short cut
             PT_WAIT_THREAD(&s->outputpt, send_headers(s, http_header_200));
-            PSOCK_SEND_STR(&s->sout, get_query_string());
+            str= get_query_string();
+            PSOCK_SEND_STR(&s->sout, str);
 
         } else if (!fs_open(s)) { // Note this has the side effect of opening the file
             DEBUG_PRINTF("404 file not found\n");