FCGI also required rewriting read_cb

"Bjorn" <[email protected]> Mon, 18 Feb 2008 06:25:42 -0000
Newsgroups gmane.text.clearsilver.general
Message-ID <[email protected]>
If you want to read POST variables with a fastcgi setup in clearsilver
and using C you have to wrap read_cb:

static int read_cb(void *ctx, char *buf, int buf_len){
    return fread (buf, sizeof(char), buf_len, FCGI_stdin);
}   

in addtion to wrapping all that other stuff (which is in the
clearsilver  source):

static int cs_printf(void *ctx, const char *s, va_list args) {
    return printf(s, args);
}

static int cs_write(void *ctx, const char *s, int n) {
    return fwrite((char *) s, 1, n, FCGI_stdout);
} 

And then call these:
cgiwrap_init_std(argc, argv, envp);
cgiwrap_init_emu(NULL, read_cb, cs_printf, cs_write, NULL, NULL, NULL);

Just FYI, I had to figure out how to do that myself. I was getting
this error:

Short read on CGI POST input 

but wraping read_cb fixed it. :)