Main Page | Modules | Namespace List | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages | Examples

mod_speling.c File Reference

#include "apr.h"
#include "apr_file_io.h"
#include "apr_strings.h"
#include "apr_lib.h"
#include "apr_want.h"
#include "httpd.h"
#include "http_core.h"
#include "http_config.h"
#include "http_request.h"
#include "http_log.h"

Include dependency graph for mod_speling.c:

Go to the source code of this file.

Defines

#define APR_WANT_STRFUNC
#define WANT_BASENAME_MATCH

Enumerations

enum  sp_reason {
  SP_IDENTICAL = 0, SP_MISCAPITALIZED = 1, SP_TRANSPOSITION = 2, SP_MISSINGCHAR = 3,
  SP_EXTRACHAR = 4, SP_SIMPLETYPO = 5, SP_VERYDIFFERENT = 6
}

Functions

static void * mkconfig (apr_pool_t *p)
static void * create_mconfig_for_server (apr_pool_t *p, server_rec *s)
static void * create_mconfig_for_directory (apr_pool_t *p, char *dir)
static const char * set_speling (cmd_parms *cmd, void *mconfig, int arg)
static sp_reason spdist (const char *s, const char *t)
static int sort_by_quality (const void *left, const void *rite)
static int check_speling (request_rec *r)
static void register_hooks (apr_pool_t *p)

Variables

module AP_MODULE_DECLARE_DATA speling_module
static const command_rec speling_cmds []
static const char * sp_reason_str []


Define Documentation

#define APR_WANT_STRFUNC
 

Definition at line 22 of file mod_speling.c.

#define WANT_BASENAME_MATCH
 

Definition at line 25 of file mod_speling.c.


Enumeration Type Documentation

enum sp_reason
 

Enumeration values:
SP_IDENTICAL 
SP_MISCAPITALIZED 
SP_TRANSPOSITION 
SP_MISSINGCHAR 
SP_EXTRACHAR 
SP_SIMPLETYPO 
SP_VERYDIFFERENT 

Definition at line 117 of file mod_speling.c.


Function Documentation

static int check_speling request_rec r  )  [static]
 

Definition at line 196 of file mod_speling.c.

References ap_escape_uri, ap_get_module_config, APLOG_INFO, APLOG_MARK, apr_dir_close(), apr_dir_open(), apr_dir_read(), APR_FINFO_DIRENT, apr_pool_create, APR_SUCCESS, bad, DECLINED, dir, apr_array_header_t::elts, spconfig::enabled, good, HTTP_MOVED_PERMANENTLY, HTTP_MULTIPLE_CHOICES, int, M_GET, name, misspelled_file::name, apr_finfo_t::name, nelts, apr_array_header_t::nelts, NULL, OK, p, apr_dir_t::pool, misspelled_file::quality, reason, ref, sort_by_quality(), SP_MISCAPITALIZED, sp_reason_str, SP_VERYDIFFERENT, spdist(), speling_module, strcasecmp(), strncasecmp(), t, and url.

Referenced by register_hooks().

Here is the call graph for this function:

static void* create_mconfig_for_directory apr_pool_t p,
char *  dir
[static]
 

Definition at line 90 of file mod_speling.c.

References mkconfig().

Here is the call graph for this function:

static void* create_mconfig_for_server apr_pool_t p,
server_rec s
[static]
 

Definition at line 82 of file mod_speling.c.

References mkconfig().

Here is the call graph for this function:

static void* mkconfig apr_pool_t p  )  [static]
 

Definition at line 70 of file mod_speling.c.

References apr_pcalloc, and spconfig::enabled.

static void register_hooks apr_pool_t p  )  [static]
 

Definition at line 513 of file mod_speling.c.

References APR_HOOK_LAST, check_speling(), and NULL.

Here is the call graph for this function:

static const char* set_speling cmd_parms cmd,
void *  mconfig,
int  arg
[static]
 

Definition at line 98 of file mod_speling.c.

References spconfig::enabled, and NULL.

static int sort_by_quality const void *  left,
const void *  rite
[static]
 

Definition at line 190 of file mod_speling.c.

References int.

Referenced by check_speling().

static sp_reason spdist const char *  s,
const char *  t
[static]
 

Definition at line 162 of file mod_speling.c.

References apr_tolower, SP_EXTRACHAR, SP_MISCAPITALIZED, SP_MISSINGCHAR, SP_SIMPLETYPO, SP_TRANSPOSITION, SP_VERYDIFFERENT, and strcasecmp().

Referenced by check_speling().

Here is the call graph for this function:


Variable Documentation

const char* sp_reason_str[] [static]
 

Initial value:

{
    "identical",
    "miscapitalized",
    "transposed characters",
    "character missing",
    "extra character",
    "mistyped character",
    "common basename",
}

Definition at line 127 of file mod_speling.c.

Referenced by check_speling().

const command_rec speling_cmds[] [static]
 

Initial value:

{
    AP_INIT_FLAG("CheckSpelling", set_speling, NULL, OR_OPTIONS,
                 "whether or not to fix miscapitalized/misspelled requests"),
    { NULL }
}

Definition at line 110 of file mod_speling.c.

module AP_MODULE_DECLARE_DATA speling_module
 

Initial value:

Definition at line 518 of file mod_speling.c.

Referenced by check_speling().