⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mod_rewrite.h

📁 Apache HTTP Server 是一个功能强大的灵活的与HTTP/1.1相兼容的web服务器.这里给出的是Apache HTTP服务器的源码。
💻 H
📖 第 1 页 / 共 2 页
字号:
    int           options;         /* the RewriteOption state */    const char   *rewritelogfile;  /* the RewriteLog filename */    apr_file_t   *rewritelogfp;    /* the RewriteLog open filepointer */    int           rewriteloglevel; /* the RewriteLog level of verbosity */    apr_array_header_t *rewritemaps;     /* the RewriteMap entries */    apr_array_header_t *rewriteconds;    /* the RewriteCond entries (temporary) */    apr_array_header_t *rewriterules;    /* the RewriteRule entries */    server_rec   *server;          /* the corresponding server indicator */    int          redirect_limit;   /* maximum number of internal redirects */} rewrite_server_conf;    /* the per-directory configuration     * generated on-the-fly by Apache server for current request     */typedef struct {    int           state;           /* the RewriteEngine state */    int           options;         /* the RewriteOption state */    apr_array_header_t *rewriteconds;    /* the RewriteCond entries (temporary) */    apr_array_header_t *rewriterules;    /* the RewriteRule entries */    char         *directory;       /* the directory where it applies */    const char   *baseurl;         /* the base-URL  where it applies */    int          redirect_limit;   /* maximum number of internal redirects */} rewrite_perdir_conf;    /* the per-request configuration     */typedef struct {    int           redirects;       /* current number of redirects */    int           redirect_limit;  /* maximum number of redirects */} rewrite_request_conf;    /* the cache structures,     * a 4-way hash apr_table_t with LRU functionality     */typedef struct cacheentry {    apr_time_t time;    char  *key;    char  *value;} cacheentry;typedef struct tlbentry {    int t[CACHE_TLB_COLS];} cachetlbentry;typedef struct cachelist {    char         *resource;    apr_array_header_t *entries;    apr_array_header_t *tlb;} cachelist;typedef struct cache {    apr_pool_t         *pool;    apr_array_header_t *lists;#if APR_HAS_THREADS    apr_thread_mutex_t *lock;#endif} cache;    /* the regex structure for the     * substitution of backreferences     */typedef struct backrefinfo {    char *source;    int nsub;    regmatch_t regmatch[AP_MAX_REG_MATCH];} backrefinfo;/*****  forward declarations***/    /* config structure handling */static void *config_server_create(apr_pool_t *p, server_rec *s);static void *config_server_merge (apr_pool_t *p, void *basev, void *overridesv);static void *config_perdir_create(apr_pool_t *p, char *path);static void *config_perdir_merge (apr_pool_t *p, void *basev, void *overridesv);    /* config directive handling */static const char *cmd_rewriteengine(cmd_parms *cmd,                                     void *dconf, int flag);static const char *cmd_rewriteoptions(cmd_parms *cmd,                                      void *dconf,                                      const char *option);static const char *cmd_rewritelog     (cmd_parms *cmd, void *dconf, const char *a1);static const char *cmd_rewriteloglevel(cmd_parms *cmd, void *dconf, const char *a1);static const char *cmd_rewritemap     (cmd_parms *cmd, void *dconf,                                        const char *a1, const char *a2);static const char *cmd_rewritelock(cmd_parms *cmd, void *dconf, const char *a1);static const char *cmd_rewritebase(cmd_parms *cmd, void *dconf,                                   const char *a1);static const char *cmd_rewritecond(cmd_parms *cmd, void *dconf,                                   const char *str);static const char *cmd_rewritecond_parseflagfield(apr_pool_t *p,                                                  rewritecond_entry *new,                                                  char *str);static const char *cmd_rewritecond_setflag(apr_pool_t *p, rewritecond_entry *cfg,                                           char *key, char *val);static const char *cmd_rewriterule(cmd_parms *cmd, void *dconf,                                   const char *str);static const char *cmd_rewriterule_parseflagfield(apr_pool_t *p,                                                  rewriterule_entry *new,                                                  char *str);static const char *cmd_rewriterule_setflag(apr_pool_t *p, rewriterule_entry *cfg,                                           char *key, char *val);    /* initialisation */static int pre_config(apr_pool_t *pconf,                      apr_pool_t *plog,                      apr_pool_t *ptemp);static int post_config(apr_pool_t *pconf,                       apr_pool_t *plog,                       apr_pool_t *ptemp,                       server_rec *s);static void init_child(apr_pool_t *p, server_rec *s);    /* runtime hooks */static int hook_uri2file   (request_rec *r);static int hook_mimetype   (request_rec *r);static int hook_fixup      (request_rec *r);static int handler_redirect(request_rec *r);    /* rewriting engine */static int apply_rewrite_list(request_rec *r, apr_array_header_t *rewriterules,                              char *perdir);static int apply_rewrite_rule(request_rec *r, rewriterule_entry *p,                              char *perdir);static int apply_rewrite_cond(request_rec *r, rewritecond_entry *p,                              char *perdir, backrefinfo *briRR,                              backrefinfo *briRC);static void do_expand(request_rec *r, char *input, char *buffer, int nbuf,		      backrefinfo *briRR, backrefinfo *briRC);static void do_expand_env(request_rec *r, char *env[],			  backrefinfo *briRR, backrefinfo *briRC);static void do_expand_cookie(request_rec *r, char *cookie[],			  backrefinfo *briRR, backrefinfo *briRC);    /* URI transformation function */static void  splitout_queryargs(request_rec *r, int qsappend);static void  fully_qualify_uri(request_rec *r);static void  reduce_uri(request_rec *r);static unsigned is_absolute_uri(char *uri);static char *escape_absolute_uri(apr_pool_t *p, char *uri, unsigned scheme);static char *expand_tildepaths(request_rec *r, char *uri);    /* rewrite map support functions */static char *lookup_map(request_rec *r, char *name, char *key);static char *lookup_map_txtfile(request_rec *r, const char *file, char *key);static char *lookup_map_dbmfile(request_rec *r, const char *file,                                 const char *dbmtype, char *key);static char *lookup_map_program(request_rec *r, apr_file_t *fpin,                                apr_file_t *fpout, char *key);typedef char *(rewrite_mapfunc_t)(request_rec *r, char *key);static void ap_register_rewrite_mapfunc(char *name, rewrite_mapfunc_t *func);APR_DECLARE_OPTIONAL_FN(void, ap_register_rewrite_mapfunc,                        (char *name, rewrite_mapfunc_t *func));static char *rewrite_mapfunc_toupper(request_rec *r, char *key);static char *rewrite_mapfunc_tolower(request_rec *r, char *key);static char *rewrite_mapfunc_escape(request_rec *r, char *key);static char *rewrite_mapfunc_unescape(request_rec *r, char *key);static char *select_random_value_part(request_rec *r, char *value);static void  rewrite_rand_init(void);static int   rewrite_rand(int l, int h);    /* rewriting logfile support */static int   open_rewritelog(server_rec *s, apr_pool_t *p);static void  rewritelog(request_rec *r, int level, const char *text, ...)                        __attribute__((format(printf,3,4)));static char *current_logtime(request_rec *r);    /* rewriting lockfile support */static apr_status_t rewritelock_create(server_rec *s, apr_pool_t *p);static apr_status_t rewritelock_remove(void *data);    /* program map support */static apr_status_t run_rewritemap_programs(server_rec *s, apr_pool_t *p);static apr_status_t rewritemap_program_child(apr_pool_t *p,                                              const char *progname, char **argv,                                             apr_file_t **fpout,                                             apr_file_t **fpin);    /* env variable support */static char *lookup_variable(request_rec *r, char *var);static char *lookup_header(request_rec *r, const char *name);    /* caching functions */static cache *init_cache(apr_pool_t *p);static char  *get_cache_string(cache *c, const char *res, int mode, apr_time_t mtime,                               char *key);static void   set_cache_string(cache *c, const char *res, int mode, apr_time_t mtime,                               char *key, char *value);static cacheentry *retrieve_cache_string(cache *c, const char *res, char *key);static void   store_cache_string(cache *c, const char *res, cacheentry *ce);    /* misc functions */static char  *subst_prefix_path(request_rec *r, char *input, char *match,                                const char *subst);static int    parseargline(char *str, char **a1, char **a2, char **a3);static int    prefix_stat(const char *path, apr_pool_t *pool);static void   add_env_variable(request_rec *r, char *s);static void   add_cookie(request_rec *r, char *s);static int    subreq_ok(request_rec *r);static int    is_redirect_limit_exceeded(request_rec *r);    /* Lexicographic Comparison */static int compare_lexicography(char *cpNum1, char *cpNum2);    /* Bracketed expression handling */static char *find_closing_bracket(char *s, int left, int right);static char *find_char_in_brackets(char *s, int c, int left, int right);#endif /* MOD_REWRITE_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -