proc: do not declare empty process variables
authorJo-Philipp Wich <jo@mein.io>
Sun, 2 Jul 2017 14:06:46 +0000 (16:06 +0200)
committerJo-Philipp Wich <jo@mein.io>
Sun, 2 Jul 2017 14:06:46 +0000 (16:06 +0200)
If a HTTP header variable has no corresponding value, then do not set it
to the empty string but to NULL, so that cgi.c will later skip it when
setting up the process environment.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
proc.c

diff --git a/proc.c b/proc.c
index 4819e08323ccd8f2bc7907b5996c5289bba37a56..a8a7142664a0d9ba0e6cb653654a613859e56b1f 100644 (file)
--- a/proc.c
+++ b/proc.c
@@ -162,7 +162,7 @@ struct env_var *uh_get_process_vars(struct client *cl, struct path_info *pi)
 
                cur = tb[proc_header_env[i].idx];
                vars[i].name = proc_header_env[i].name;
-               vars[i].value = cur ? blobmsg_data(cur) : "";
+               vars[i].value = cur ? blobmsg_data(cur) : NULL;
        }
 
        memcpy(&vars[i], extra_vars, sizeof(extra_vars));