mod_echo.c revision 78cd48acd325773619d78ac0d7263a99a8922fae
/* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ap_config.h"
#include "ap_mmn.h"
#include "httpd.h"
#include "http_config.h"
#include "http_connection.h"
#include "apr_buckets.h"
#include "util_filter.h"
typedef struct {
int bEnabled;
} EchoConfig;
{
return pConfig;
}
{
&echo_module);
return NULL;
}
static int process_echo_connection(conn_rec *c)
{
apr_bucket *b;
&echo_module);
return DECLINED;
}
for ( ; ; ) {
/* Get a single line of input from the client */
APR_BLOCK_READ, 0) != APR_SUCCESS ||
APR_BRIGADE_EMPTY(bb))) {
break;
}
/* Make sure the data is flushed to the client */
b = apr_bucket_flush_create(c->bucket_alloc);
}
return OK;
}
static const command_rec echo_cmds[] =
{
"Run an echo server on this host"),
{ NULL }
};
static void register_hooks(apr_pool_t *p)
{
}
NULL, /* create per-directory config structure */
NULL, /* merge per-directory config structures */
create_echo_server_config, /* create per-server config structure */
NULL, /* merge per-server config structures */
echo_cmds, /* command apr_table_t */
register_hooks /* register hooks */
};