Skip to content

Commit

Permalink
Name "=" and "&;"
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Jul 8, 2012
1 parent bb6af7e commit 6b168ae
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/ctx.c
Expand Up @@ -1192,6 +1192,9 @@ get_command_version(grn_ctx *ctx, const char *p, const char *pe)
#define OUTPUT_TYPE_LEN (sizeof(OUTPUT_TYPE) - 1)
#define COMMAND_VERSION_LEN (sizeof(COMMAND_VERSION) - 1)

#define HTTP_QUERY_PAIR_DELIMITER "="
#define HTTP_QUERY_PAIRS_DELIMITERS "&;"

static inline int
command_proc_p(grn_obj *expr)
{
Expand All @@ -1215,26 +1218,26 @@ grn_ctx_qe_exec_uri(grn_ctx *ctx, const char *path, uint32_t path_len)
while (p < e) {
int l;
GRN_BULK_REWIND(&buf);
p = grn_text_cgidec(ctx, &buf, p, e, "=");
p = grn_text_cgidec(ctx, &buf, p, e, HTTP_QUERY_PAIR_DELIMITER);
v = GRN_TEXT_VALUE(&buf);
l = GRN_TEXT_LEN(&buf);
if (l == OUTPUT_TYPE_LEN && !memcmp(v, OUTPUT_TYPE, OUTPUT_TYPE_LEN)) {
GRN_BULK_REWIND(&buf);
p = grn_text_cgidec(ctx, &buf, p, e, "&;");
p = grn_text_cgidec(ctx, &buf, p, e, HTTP_QUERY_PAIRS_DELIMITERS);
v = GRN_TEXT_VALUE(&buf);
get_content_mime_type(ctx, v, GRN_BULK_CURR(&buf));
} else if (l == COMMAND_VERSION_LEN &&
!memcmp(v, COMMAND_VERSION, COMMAND_VERSION_LEN)) {
GRN_BULK_REWIND(&buf);
p = grn_text_cgidec(ctx, &buf, p, e, "&;");
p = grn_text_cgidec(ctx, &buf, p, e, HTTP_QUERY_PAIRS_DELIMITERS);
get_command_version(ctx, GRN_TEXT_VALUE(&buf), GRN_BULK_CURR(&buf));
if (ctx->rc) { goto exit; }
} else {
if (!(val = grn_expr_get_or_add_var(ctx, expr, v, l))) {
val = &buf;
}
grn_obj_reinit(ctx, val, GRN_DB_TEXT, 0);
p = grn_text_cgidec(ctx, val, p, e, "&;");
p = grn_text_cgidec(ctx, val, p, e, HTTP_QUERY_PAIRS_DELIMITERS);
}
}
ctx->impl->curr_expr = expr;
Expand Down

0 comments on commit 6b168ae

Please sign in to comment.