httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Sutton <...@hyperreal.com>
Subject cvs commit: apache/src mod_alias.c
Date Mon, 04 Nov 1996 09:34:05 GMT
pcs         96/11/04 01:34:05

  Modified:    src       mod_alias.c
  Log:
  Reviewed-by: Chuck Murcko, Mark Cox
  
  Add NCSA-compatible RedirectTemp and RedirectPermanent directives.
  Also allow 410 Gone status with "Redirect URL gone".
  
  Revision  Changes    Path
  1.10      +26 -12    apache/src/mod_alias.c
  
  Index: mod_alias.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/mod_alias.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -C3 -r1.9 -r1.10
  *** mod_alias.c	1996/11/03 20:48:28	1.9
  --- mod_alias.c	1996/11/04 09:34:04	1.10
  ***************
  *** 65,70 ****
  --- 65,71 ----
        char *real;
        char *fake;
        char *handler;
  +     int redir_status;		/* 301, 302, 303 */
    } alias_entry;
    
    typedef struct {
  ***************
  *** 136,152 ****
        server_rec *s = cmd->server;
        alias_server_conf *serverconf =
            (alias_server_conf *)get_module_config(s->module_config,&alias_module);
    
  !     if (!is_url (url)) return "Redirect to non-URL";
        if ( cmd->path )
  -     {
            new = push_array (dirconf->redirects);
  -     }
        else
  -     {
            new = push_array (serverconf->redirects);
  !     }
        new->fake = f; new->real = url;
        return NULL;
    }
    
  --- 137,157 ----
        server_rec *s = cmd->server;
        alias_server_conf *serverconf =
            (alias_server_conf *)get_module_config(s->module_config,&alias_module);
  +     int status;
    
  !     if (!strcasecmp(url, "gone"))
  ! 	status = HTTP_GONE;
  !     else {
  ! 	if (!is_url (url)) return "Redirect to non-URL";
  ! 	status = (int)cmd->info;
  !     }
        if ( cmd->path )
            new = push_array (dirconf->redirects);
        else
            new = push_array (serverconf->redirects);
  ! 
        new->fake = f; new->real = url;
  +     new->redir_status = status;
        return NULL;
    }
    
  ***************
  *** 155,161 ****
        "a fakename and a realname"},
    { "ScriptAlias", add_alias, "cgi-script", RSRC_CONF, TAKE2, 
        "a fakename and a realname"},
  ! { "Redirect", add_redirect, NULL, OR_FILEINFO, TAKE2, 
        "a document to be redirected, then the destination URL" },
    { NULL }
    };
  --- 160,170 ----
        "a fakename and a realname"},
    { "ScriptAlias", add_alias, "cgi-script", RSRC_CONF, TAKE2, 
        "a fakename and a realname"},
  ! { "Redirect", add_redirect, (void*)302, OR_FILEINFO, TAKE2, 
  !     "a document to be redirected, then the destination URL (or \"Gone\")" },
  ! { "RedirectTemp", add_redirect, (void*)302, OR_FILEINFO, TAKE2, 
  !     "a document to be redirected, then the destination URL" },
  ! { "RedirectPermanent", add_redirect, (void*)301, OR_FILEINFO, TAKE2, 
        "a document to be redirected, then the destination URL" },
    { NULL }
    };
  ***************
  *** 194,200 ****
        return urip - uri;
    }
    
  ! char *try_alias_list (request_rec *r, array_header *aliases, int doesc)
    {
        alias_entry *entries = (alias_entry *)aliases->elts;
        int i;
  --- 203,209 ----
        return urip - uri;
    }
    
  ! char *try_alias_list (request_rec *r, array_header *aliases, int doesc, int *status)
    {
        alias_entry *entries = (alias_entry *)aliases->elts;
        int i;
  ***************
  *** 209,217 ****
  --- 218,229 ----
    		table_set (r->notes, "alias-forced-type", p->handler);
    	    }
    
  + 	    *status = p->redir_status;
  + 
    	    if (doesc) {
    		char *escurl;
    		escurl = os_escape_path(r->pool, r->uri + l, 1);
  + 
    		return pstrcat(r->pool, p->real, escurl, NULL);
    	    } else
    		return pstrcat(r->pool, p->real, r->uri + l, NULL);
  ***************
  *** 227,232 ****
  --- 239,245 ----
        alias_server_conf *serverconf =
            (alias_server_conf *)get_module_config(sconf, &alias_module);
        char *ret;
  +     int status;
    
    #ifdef __EMX__
        /* Add support for OS/2 drive names */
  ***************
  *** 236,247 ****
    #endif    
            return DECLINED;
    
  !     if ((ret = try_alias_list (r, serverconf->redirects, 1)) != NULL) {
            table_set (r->headers_out, "Location", ret);
  !         return REDIRECT;
        }
        
  !     if ((ret = try_alias_list (r, serverconf->aliases, 0)) != NULL) {
            r->filename = ret;
            return OK;
        }
  --- 249,260 ----
    #endif    
            return DECLINED;
    
  !     if ((ret = try_alias_list (r, serverconf->redirects, 1, &status)) != NULL)
{
            table_set (r->headers_out, "Location", ret);
  !         return status;
        }
        
  !     if ((ret = try_alias_list (r, serverconf->aliases, 0, &status)) != NULL) {
            r->filename = ret;
            return OK;
        }
  ***************
  *** 255,266 ****
        alias_dir_conf *dirconf =
            (alias_dir_conf *)get_module_config(dconf, &alias_module);
        char *ret;
    
        /* It may have changed since last time, so try again */
    
  !     if ((ret = try_alias_list (r, dirconf->redirects, 1)) != NULL) {
            table_set (r->headers_out, "Location", ret);
  !         return REDIRECT;
        }
    
        return DECLINED;
  --- 268,280 ----
        alias_dir_conf *dirconf =
            (alias_dir_conf *)get_module_config(dconf, &alias_module);
        char *ret;
  +     int status;
    
        /* It may have changed since last time, so try again */
    
  !     if ((ret = try_alias_list (r, dirconf->redirects, 1, &status)) != NULL) {
            table_set (r->headers_out, "Location", ret);
  !         return status;
        }
    
        return DECLINED;
  
  
  

Mime
View raw message