Possible compatibility problems with earlier versions marked with '*'.
+Fixed bug #272: Preserve spacing for CCL terms.
+
--- 2.1.0 2005/03/14
Added support for virtual hosts and multiple backend servers for
/*
* CCL - header file
*
- * $Id: ccl.h,v 1.20 2004-10-15 00:18:59 adam Exp $
+ * $Id: ccl.h,v 1.21 2005-03-15 16:32:52 adam Exp $
*
* Old Europagate Log:
*
/** CCL token */
struct ccl_token {
char kind;
- size_t len;
- const char *name;
+ size_t len; /* length of name below */
+ const char *name; /* string / name of token */
struct ccl_token *next;
struct ccl_token *prev;
+ const char *ws_prefix_buf; /* leading white space buf */
+ size_t ws_prefix_len; /* leading white space len */
};
/** CCL Qualifier */
/* CCL find (to rpn conversion)
* Europagate, 1995
*
- * $Id: cclfind.c,v 1.6 2004-10-15 00:18:59 adam Exp $
+ * $Id: cclfind.c,v 1.7 2005-03-15 16:32:52 adam Exp $
*
* Old Europagate log:
*
else
mid_trunc = 1;
}
- len += 1+lookahead->len;
+ len += 1+lookahead->len+lookahead->ws_prefix_len;
lookahead = lookahead->next;
}
}
if (i == no-1 && right_trunc)
src_len--;
- if (src_len)
- {
- int len = strlen(p->u.t.term);
- if (len &&
- !strchr("-+", *src_str) &&
- !strchr("-+", p->u.t.term[len-1]))
- {
- strcat (p->u.t.term, " ");
- }
+ if (i && cclp->look_token->ws_prefix_len)
+ {
+ size_t len = strlen(p->u.t.term);
+ memcpy(p->u.t.term + len, cclp->look_token->ws_prefix_buf,
+ cclp->look_token->ws_prefix_len);
+ p->u.t.term[len + cclp->look_token->ws_prefix_len] = '\0';
}
strxcat (p->u.t.term, src_str, src_len);
ADVANCE;
/* CCL - lexical analysis
* Europagate, 1995
*
- * $Id: ccltoken.c,v 1.5 2004-10-15 00:19:00 adam Exp $
+ * $Id: ccltoken.c,v 1.6 2005-03-15 16:32:52 adam Exp $
*
* Old Europagate Log:
*
while (1)
{
+ const unsigned char *cp0 = cp;
while (*cp && strchr (" \t\r\n", *cp))
{
cp++;
last->next->prev = last;
last = last->next;
}
+ last->ws_prefix_buf = cp0;
+ last->ws_prefix_len = cp - cp0;
last->next = NULL;
last->name = (const char *) cp;
last->len = 1;
* Copyright (C) 1995-2005, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: tstccl.c,v 1.6 2005-02-01 17:23:36 adam Exp $
+ * $Id: tstccl.c,v 1.7 2005-03-15 16:32:53 adam Exp $
*/
/* CCL test */
{ "x= -1980", "@attr 2=3 -1980 "},
{ "x=234-1990", "@attr 2=3 234-1990 "},
{ "x=234 - 1990", "@and @attr 2=4 234 @attr 2=2 1990 "},
+ { "ti=a,b", "@attr 4=1 @attr 1=4 a,b "},
+ { "ti=a, b", "@attr 4=1 @attr 1=4 a,\\ b "},
+ { "ti=a-b", "@attr 4=2 @attr 1=4 a-b "},
+ { "ti=a - b", "@attr 4=1 @attr 1=4 a\\ -\\ b "},
{0, 0}
};
if (!query_str[i].result)
{
printf ("Failed %s\n", query_str[i].query);
- printf (" got:%s:\n", wrbuf_buf(wrbuf));
+ printf (" got: %s:\n", wrbuf_buf(wrbuf));
printf (" expected failure\n");
(*number_of_errors)++;
}
else if (strcmp(wrbuf_buf(wrbuf), query_str[i].result))
{
printf ("Failed %s\n", query_str[i].query);
- printf (" got:%s:\n", wrbuf_buf(wrbuf));
+ printf (" got: %s:\n", wrbuf_buf(wrbuf));
printf (" expected:%s:\n", query_str[i].result);
(*number_of_errors)++;
}