How can a CGI get the username of the session?

I have a CGI that needs to change its content based on what user is logged in. I am using DC 9.50 and rabbitweb on an RCM3315. I have traced into HTTP.LIB and found that authenticated userid is saved to state->context.userid.

But in my CGI, FileListCGI(HttpState * s), s->context.userid is -1.

How can I get to the state structure where my authentication was saved, from the application-level CGI callback?


The call above should have worked. Debugging into HTTP.LIB, I found that the address that the user id is saved to is the same as the address I am checking in the callback. Something stomps it between authentication and callback.

I added a global int LastAuthUser to HTTP.LIB. You have to put it between the BeginHeader and EndHeader comment lines to make it visible outside the LIB.