mod_allowmethods.c revision cf9acd789f86df61f77c735ec3a45b0f5c88bacb
/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 "httpd.h"
#include "http_core.h"
#include "http_config.h"
#include "http_protocol.h"
#include "http_request.h"
#include "http_log.h"
#include "apr_strings.h"
/**
* This module makes it easy to restrict what HTTP methods can be ran against
* a server.
*
* It provides one comand:
* AllowMethods
* This command takes a list of HTTP methods to allow.
*
* The most common configuration should be like this:
* <Directory />
* AllowMethods GET HEAD OPTIONS
* </Directory>
* AllowMethods GET HEAD OPTIONS POST
* </Directory>
* Non-matching methods will be returned a status 405 (method not allowed)
*
* To allow all methods, and effectively turn off mod_allowmethods, use:
* AllowMethods reset
*/
typedef struct am_conf_t {
int allowed_set;
} am_conf_t;
static int am_check_access(request_rec *r)
{
int method = r->method_number;
return DECLINED;
}
return DECLINED;
}
"client method denied by server configuration: '%s' to %s%s",
r->method,
return HTTP_METHOD_NOT_ALLOWED;
}
{
conf->allowed_set = 0;
return conf;
}
if (add->allowed_set) {
}
else {
}
return conf;
}
char *const argv[])
{
int i;
if (argc == 0) {
return "AllowMethods: No method or 'reset' keyword given";
}
if (argc == 1) {
return NULL;
}
}
for (i = 0; i < argc; i++) {
int m;
m = ap_method_number_of(argv[i]);
if (m == M_INVALID) {
}
}
return NULL;
}
static void am_register_hooks(apr_pool_t * p)
{
}
static const command_rec am_cmds[] = {
"only allow specific methods"),
{NULL}
};
NULL,
NULL,
};