/[Apache-SVN]/httpd/httpd/trunk/modules/mappers/mod_alias.c
ViewVC logotype

Diff of /httpd/httpd/trunk/modules/mappers/mod_alias.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 780655, Mon Jun 1 14:08:19 2009 UTC revision 780692, Mon Jun 1 15:39:33 2009 UTC
# Line 176  static const char *add_redirect_internal Line 176  static const char *add_redirect_internal
176      alias_server_conf *serverconf = ap_get_module_config(s->module_config,      alias_server_conf *serverconf = ap_get_module_config(s->module_config,
177                                                           &alias_module);                                                           &alias_module);
178      int status = (int) (long) cmd->info;      int status = (int) (long) cmd->info;
179      ap_regex_t *r = NULL;      int grokarg1 = 1;
180    =    ap_regex_t *r = NULL;
181      const char *f = arg2;      const char *f = arg2;
182      const char *url = arg3;      const char *url = arg3;
183    
184      if (!arg3 && !strcasecmp(arg1, "gone"))      /*
185          status = HTTP_GONE;       * Logic flow:
186      else if (apr_isdigit(*arg1))       *   Go ahead and try to grok the 1st arg, in case it is a
187          status = atoi(arg1);       *   Redirect status. Now if we have 3 args, we expect that
188      else if (arg3) {       *   we were able to understand that 1st argument (it's something
189         *   we expected, so if not, then we bail. We also check that we
190         *   don't have a 3rd argument with GONE or with numeric codes
191         *   outside of 300-399; if we do, then that's an error.
192         */
193          if (!strcasecmp(arg1, "permanent"))          if (!strcasecmp(arg1, "permanent"))
194              status = HTTP_MOVED_PERMANENTLY;              status = HTTP_MOVED_PERMANENTLY;
195          else if (!strcasecmp(arg1, "temp"))          else if (!strcasecmp(arg1, "temp"))
196              status = HTTP_MOVED_TEMPORARILY;              status = HTTP_MOVED_TEMPORARILY;
197          else if (!strcasecmp(arg1, "seeother"))          else if (!strcasecmp(arg1, "seeother"))
198              status = HTTP_SEE_OTHER;              status = HTTP_SEE_OTHER;
199          else {      else if (!strcasecmp(arg1, "gone"))
200            status = HTTP_GONE;
201        else if (apr_isdigit(*arg1))
202            status = atoi(arg1);
203        else
204            grokarg1 = 0;
205    
206        if (arg3 && !grokarg1)
207              return "Redirect: invalid first argument (of three)";              return "Redirect: invalid first argument (of three)";
208          }  
209      }      if (arg3 && status == HTTP_GONE)
210      else {          return "Redirect: third argument not expected";
211    
212        if (arg3 && (apr_isdigit(*arg1) && (status < 300 || status > 399)))
213            return "Redirect: third argument not expected";
214    
215        /*
216         * if we don't have the 3rd arg and we didn't understand the 1st
217         * one, then assume URL-path URL. This also handles case, eg, GONE
218         * we even though we don't have a 3rd arg, we did understand the 1st
219         * one, so we don't want to re-arrange
220         */
221        if (!arg3 && !grokarg1) {
222          f = arg1;          f = arg1;
223          url = arg2;          url = arg2;
224      }      }

Legend:
Removed from v.780655  
changed lines
  Added in v.780692

apache@apache.org
ViewVC Help
Powered by ViewVC 1.1.2