I've been playing with basic modules that implement their own protocol 
(process_connection hooked) along the lines of the mod_echo example. But 
one thing I can't seem to do is send output immediately back to the client, 
even though I am flushing the output filters.

With the following code, if I telnet localhost I don't see the "hello" 
until I first send some line, or close the connection. Contrast to say a 
POP3 server where you see the +greeting as soon as you connect. I did look 
at the mod_pop3 code but can't understand what it does differently than 
this. Do I have to explicitly do something with the input_filters here? 
Currently I don't touch the input side, but something is introducing a 
delay.

static int rdate_process_connection(conn_rec *c)
{
        apr_bucket_brigade *bb;
        rdate_cfg* cfg = ap_get_module_config(c->base_server->module_config,
                &rdate_module);
        if (!cfg->rdate_enabled)
                return DECLINED;

        bb = apr_brigade_create(c->pool, c->bucket_alloc);
        ap_fprintf(c->output_filters, bb, "hello\n");
        ap_fflush(c->output_filters, bb);
        return OK;
}


Reply via email to