From: Jeremy Tan Date: Tue, 24 Sep 2013 04:43:40 +0000 (+0800) Subject: Update fastcgi bool type X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=c78aae4af28df47f11bf41537cc6945ddba3e27d;p=matches%2FMCTX3420.git Update fastcgi bool type --- 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 @@ + +