Ugh.
Ok, I missed this on the first round.  You've reversed arguments 2 & 3 on the call to Ns_TclEval.  From the docs:

    int Ns_TclEval (
Ns_DString *pds,
char *hServer
char *script
);

Examples

Use this code to call ns_sendmail from C:

    NS_DStringVarAppend(&dsScript, "ns_sendmail", to, " ",
ââfrom, " ", subject, " ", body);
status=Ns_TclEval(&dsResult, Ns_ConnServer(conn),
ââdsScript.string)

Mike Schilli wrote on 7/6/2004, 1:30 PM:

Mark Page wrote on 7/6/2004, 6:14 AM:
Is it true that this code fragment will be running from a 'connection' thread -- e.g., servicing a connection.   Use of the Ns_GetConn function implies that it is.
Are there any messages in your server log when you run this?
Correct, it's being used by a connection thread, I've verified that "conn" and the value for the server are valid.

There's no unusual messages in the server.log:

[06/Jul/2004:10:22:08][1747.32773][-driver-] Notice: starting
[06/Jul/2004:10:22:08][1747.32773][-driver-] Notice: driver: accepting connections
[06/Jul/2004:10:22:20][1747.40966][-conn:server1::0] Debug: status=-1 result=''

Could it be that Ns_TclEval() is broken? I'm using

Ns_RegisterFilter(server, "*", "*", some_handler,
                      NS_FILTER_PRE_AUTH, NULL);
static int
some_handler(void *context, Ns_Conn *conn, int why)
{
    evaltest();
}

int evaltest() {
        int status;

        Ns_DString result;
        Ns_DString script;
        Ns_DStringInit(&script);
        Ns_DStringInit(&result);

        Ns_DStringVarAppend(&script, "set a b", NULL);
        status = Ns_TclEval(&result, script.string,
                 Ns_ConnServer(Ns_GetConn()));
        Ns_Log(Debug, "status=%d result='%s'", status, result.string);
        return 0;
}

Would be great if you could verify that the above works fine under v40_r5. Thanks!

--
-- Mike
Mike Schilli
[EMAIL PROTECTED]


-- AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.

Reply via email to