In my previous post, I wrote about problem with bool array.
I have examined in depth my issue, and the behavior is odd.
I've this code copied from vibe.d/examples/web:
module app;
import vibe.d;
class SampleService {
// "GET /"
@path("/") void getHome() {
render!("home.dt");
}
// POST /settings
void postSettings(string[] x) {
foreach (i, v; x) {
logInfo("x[%s]=%s", i, v);
}
redirect("./");
}
}
shared static this() {
auto router = new URLRouter;
router.registerWebInterface(new SampleService);
router.get("*", serveStaticFiles("public/"));
auto settings = new HTTPServerSettings;
settings.port = 8080;
settings.bindAddresses = ["::1", "127.0.0.1"];
settings.accessLogToConsole = true;
listenHTTP(settings, router);
logInfo("Please open http://127.0.0.1:8080/ in your browser.");
}
with this template:
// home.dt
doctype html
html
head
title Sample service
body
form(method="POST", action="settings")
div
label Some setting 0
input(name="x_0", type="checkbox")
label Some setting 1
input(name="x_1", type="checkbox")
label Some setting 2
input(name="x_2", type="checkbox")
div
button(type="sumbit") OK
and all works well:
127.0.0.1 - - 2015-Oct-09 07:01:38.446259Z "GET / HTTP/1.1" 200 457 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0"
x[0]=on
127.0.0.1 - - 2015-Oct-09 07:01:40.973303Z "POST /settings HTTP/1.1" 302 14 "http://127.0.0.1:8080/" "Mozilla/5.0 (X11; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0"
so, if I change
void postSettings(string[] x) {
to
void postSettings(bool[] x) {
when I click submit
the server freezes.
Thank you...