mod_echo.c revision e8f95a682820a599fe41b22977010636be5c2717
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina/* Copyright 1999-2005 The Apache Software Foundation or its licensors, as
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina * applicable.
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina * Licensed under the Apache License, Version 2.0 (the "License");
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina * you may not use this file except in compliance with the License.
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina * You may obtain a copy of the License at
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina * Unless required by applicable law or agreed to in writing, software
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina * distributed under the License is distributed on an "AS IS" BASIS,
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina * See the License for the specific language governing permissions and
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina * limitations under the License.
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březinatypedef struct {
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březinastatic void *create_echo_server_config(apr_pool_t *p, server_rec *s)
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina EchoConfig *pConfig = apr_pcalloc(p, sizeof *pConfig);
bbc34d5a6e84d6c337bd89a22d33e365eb466226Pavel Březinastatic const char *echo_on(cmd_parms *cmd, void *dummy, int arg)
c4d4fe1603420fe8f3d256a3a446974699563ff3Petr Cech EchoConfig *pConfig = ap_get_module_config(cmd->server->module_config,
4e5e846de22407f825fe3b4040d79606818a2419Jakub Hrozek EchoConfig *pConfig = ap_get_module_config(c->base_server->module_config,
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina bb = apr_brigade_create(c->pool, c->bucket_alloc);
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Get a single line of input from the client */
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina if ((rv = ap_get_brigade(c->input_filters, bb, AP_MODE_GETLINE,
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Make sure the data is flushed to the client */
3688374991afb34bbaf2b7843683fc13dd77879dPavel Březina /* Send back the data. */
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina AP_INIT_FLAG("ProtocolEcho", echo_on, NULL, RSRC_CONF,
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina "Run an echo server on this host"),
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina ap_hook_process_connection(process_echo_connection, NULL, NULL,
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina NULL, /* create per-directory config structure */
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina NULL, /* merge per-directory config structures */
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina create_echo_server_config, /* create per-server config structure */
360a4be4266d6a72be99dfd252623dc0527f5b84Pavel Březina NULL, /* merge per-server config structures */