From 0e485d94093a09b4095a5b7f9b80afa1ec0fd570 Mon Sep 17 00:00:00 2001 From: Jeremy Tan Date: Tue, 24 Sep 2013 12:43:40 +0800 Subject: [PATCH] Update fastcgi bool type --- server/fastcgi.c | 11 ++++++++++- testing/MCTXWeb/public_html/index.html | 6 ++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/server/fastcgi.c b/server/fastcgi.c index 67f7de3..89386f3 100644 --- a/server/fastcgi.c +++ b/server/fastcgi.c @@ -227,7 +227,16 @@ bool FCGI_ParseRequest(FCGIContext *context, char *params, FCGIValue values[], s switch(FCGI_TYPE(val->flags)) { case FCGI_BOOL_T: - *((bool*) val->value) = true; + if (!*value) //No value: Default true + *((bool*) val->value) = true; + else { + *((bool*) val->value) = !!(strtol(value, &ptr, 10)); + if (*ptr) { + snprintf(buf, BUFSIZ, "Expected bool for '%s' but got '%s'", key, value); + FCGI_RejectJSON(context, buf); + return false; + } + } break; case FCGI_INT_T: case FCGI_LONG_T: { long parsed = strtol(value, &ptr, 10); diff --git a/testing/MCTXWeb/public_html/index.html b/testing/MCTXWeb/public_html/index.html index 7061f8d..f7ff692 100644 --- a/testing/MCTXWeb/public_html/index.html +++ b/testing/MCTXWeb/public_html/index.html @@ -64,6 +64,10 @@
Pressure controls
+
+ Pressure level
+ +
@@ -110,6 +114,8 @@ + + -- 2.20.1