In some situations, I am executing the following code in my web event handler to trigger the browser to use basic authentication:
mg_send_head(c, 401, 0, "WWW-Authenticate: Basic realm=\"User Visible Realm\"");
mg_send(c, NULL, 0);
c->flags |= MG_F_SEND_AND_CLOSE;
However, I am encountering strange behaviour, so I'd like to ask if this is correct.