MCPcopy Create free account
hub / github.com/apache/httpd / hook_fixup

Function hook_fixup

modules/mappers/mod_rewrite.c:5247–5614  ·  view source on GitHub ↗

* Fixup hook * [RewriteRules in directory context] */

Source from the content-addressed store, hash-verified

5245 * [RewriteRules in directory context]
5246 */
5247static int hook_fixup(request_rec *r)
5248{
5249 rewrite_perdir_conf *dconf;
5250 char *cp;
5251 char *cp2;
5252 const char *ccp;
5253 apr_size_t l;
5254 int rulestatus;
5255 int n;
5256 char *ofilename, *oargs;
5257 int is_proxyreq;
5258 void *skipdata;
5259 rewriterule_entry *lastsub;
5260
5261 dconf = (rewrite_perdir_conf *)ap_get_module_config(r->per_dir_config,
5262 &rewrite_module);
5263
5264 /* if there is no per-dir config we return immediately */
5265 if (dconf == NULL) {
5266 return DECLINED;
5267 }
5268
5269 /*
5270 * only do something under runtime if the engine is really enabled,
5271 * for this directory, else return immediately!
5272 */
5273 if (dconf->state == ENGINE_DISABLED) {
5274 return DECLINED;
5275 }
5276
5277 /* if there are no real (i.e. no RewriteRule directives!)
5278 per-dir config of us, we return also immediately */
5279 if (dconf->directory == NULL) {
5280 return DECLINED;
5281 }
5282
5283 /*
5284 * Proxy request?
5285 */
5286 is_proxyreq = ( r->proxyreq && r->filename
5287 && !strncmp(r->filename, "proxy:", 6));
5288
5289 /*
5290 * .htaccess file is called before really entering the directory, i.e.:
5291 * URL: http://localhost/foo and .htaccess is located in foo directory
5292 * Ignore such attempts, allowing mod_dir to direct the client to the
5293 * canonical URL. This can be controlled with the AllowNoSlash option.
5294 */
5295 if (!is_proxyreq && !(dconf->options & OPTION_NOSLASH)) {
5296 l = strlen(dconf->directory) - 1;
5297 if (r->filename && strlen(r->filename) == l &&
5298 (dconf->directory)[l] == '/' &&
5299 !strncmp(r->filename, dconf->directory, l)) {
5300 return DECLINED;
5301 }
5302 }
5303
5304 /* END flag was used as a RewriteRule flag on this request */

Callers

nothing calls this directly

Calls 12

ap_get_module_configFunction · 0.85
ap_allow_optionsFunction · 0.85
apply_rewrite_listFunction · 0.85
is_absolute_uriFunction · 0.85
ap_scan_vchar_obstextFunction · 0.85
ap_strchrFunction · 0.85
subst_prefix_pathFunction · 0.85
escape_absolute_uriFunction · 0.85
ap_os_is_path_absoluteFunction · 0.85
ap_document_rootFunction · 0.85
ap_context_document_rootFunction · 0.85
ap_context_prefixFunction · 0.85

Tested by

no test coverage detected