-const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.57 2009/06/03 16:44:15 fabiankeil Exp $";
+const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.58 2009/06/03 16:44:41 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/urlmatch.c,v $
const char urlmatch_h_rcs[] = URLMATCH_H_VERSION;
-enum regex_anchoring {NO_ANCHORING, LEFT_ANCHORED, RIGHT_ANCHORED};
+enum regex_anchoring
+{
+ NO_ANCHORING,
+ LEFT_ANCHORED,
+ RIGHT_ANCHORED,
+ RIGHT_ANCHORED_HOST
+};
static jb_err compile_host_pattern(struct url_spec *url, const char *host_pattern);
/*********************************************************************
*
* Parameters :
* 1 : pattern = The pattern to compile.
- * 2 : anchoring = How the regex should be anchored.
- * Can be either one of NO_ANCHORING,
- * LEFT_ANCHORED or RIGHT_ANCHORED.
+ * 2 : anchoring = How the regex should be modified
+ * before compilation. Can be either
+ * one of NO_ANCHORING, LEFT_ANCHORED,
+ * RIGHT_ANCHORED or RIGHT_ANCHORED_HOST.
* 3 : url = In case of failures, the spec member is
* logged and the structure freed.
* 4 : regex = Where the compiled regex should be stored.
case RIGHT_ANCHORED:
fmt = "%s$";
break;
+ case RIGHT_ANCHORED_HOST:
+ fmt = "%s\\.?$";
+ break;
case LEFT_ANCHORED:
fmt = "^%s";
break;
*********************************************************************/
static jb_err compile_host_pattern(struct url_spec *url, const char *host_pattern)
{
- return compile_pattern(host_pattern, RIGHT_ANCHORED, url, &url->host_regex);
+ return compile_pattern(host_pattern, RIGHT_ANCHORED_HOST, url, &url->host_regex);
}
#else