assert(http_GetReq(sp->http, &p));
return (p);
}
+
+/*--------------------------------------------------------------------*/
+
+void
+VRT_handling(struct sess *sp, enum handling hand)
+{
+
+ sp->handling = hand;
+}
enum handling handling;
- char done;
-
TAILQ_ENTRY(sess) list;
sesscb_f *sesscb;
#endif
typedef void vcl_init_f(void);
-typedef void vcl_func_f(struct sess *sp);
+typedef int vcl_func_f(struct sess *sp);
struct VCL_conf {
unsigned magic;
char *VRT_GetHdr(struct sess *, const char *);
char *VRT_GetReq(struct sess *);
+void VRT_handling(struct sess *sp, enum handling hand);
-#define VRT_done(sess, hand) \
+#define VRT_done(sp, hand) \
do { \
- sess->handling = hand; \
- sess->done = 1; \
- return; \
+ VRT_handling(sp, hand); \
+ return (1); \
} while (0)
case T_CALL:
ExpectErr(tl, ID);
AddRef(tl, tl->t, R_FUNC);
- I(tl);
- sbuf_printf(tl->fc, "VGC_function_%*.*s(sp);\n",
+ I(tl); sbuf_printf(tl->fc,
+ "if (VGC_function_%*.*s(sp))\n",
tl->t->e - tl->t->b,
tl->t->e - tl->t->b, tl->t->b);
- I(tl); sbuf_printf(tl->fc, "if (sp->done)\n");
- I(tl); sbuf_printf(tl->fc, "\treturn;\n");
+ I(tl); sbuf_printf(tl->fc, "\treturn (1);\n");
NextToken(tl);
return;
case T_REWRITE:
NextToken(tl);
ExpectErr(tl, ID);
AddDef(tl, tl->t, R_FUNC);
- sbuf_printf(tl->fh, "static void VGC_function_%*.*s (struct sess *sp);\n",
+ sbuf_printf(tl->fh, "static int VGC_function_%*.*s (struct sess *sp);\n",
tl->t->e - tl->t->b,
tl->t->e - tl->t->b, tl->t->b);
- I(tl);
- sbuf_printf(tl->fc, "static void\n");
- I(tl);
- sbuf_printf(tl->fc, "VGC_function_%*.*s (struct sess *sp)\n",
+ I(tl); sbuf_printf(tl->fc, "static int\n");
+ I(tl); sbuf_printf(tl->fc, "VGC_function_%*.*s (struct sess *sp)\n",
tl->t->e - tl->t->b,
tl->t->e - tl->t->b, tl->t->b);
NextToken(tl);
fputs("\n", f);
fputs(" enum handling handling;\n", f);
fputs("\n", f);
- fputs(" char done;\n", f);
- fputs("\n", f);
fputs(" TAILQ_ENTRY(sess) list;\n", f);
fputs("\n", f);
fputs(" sesscb_f *sesscb;\n", f);
fputs("#endif\n", f);
fputs("\n", f);
fputs("typedef void vcl_init_f(void);\n", f);
- fputs("typedef void vcl_func_f(struct sess *sp);\n", f);
+ fputs("typedef int vcl_func_f(struct sess *sp);\n", f);
fputs("\n", f);
fputs("struct VCL_conf {\n", f);
fputs(" unsigned magic;\n", f);
fputs("\n", f);
fputs("char *VRT_GetHdr(struct sess *, const char *);\n", f);
fputs("char *VRT_GetReq(struct sess *);\n", f);
+ fputs("void VRT_handling(struct sess *sp, enum handling hand);\n", f);
fputs("\n", f);
- fputs("#define VRT_done(sess, hand) \\\n", f);
+ fputs("#define VRT_done(sp, hand) \\\n", f);
fputs(" do { \\\n", f);
- fputs(" sess->handling = hand; \\\n", f);
- fputs(" sess->done = 1; \\\n", f);
- fputs(" return; \\\n", f);
+ fputs(" VRT_handling(sp, hand); \\\n", f);
+ fputs(" return (1); \\\n", f);
fputs(" } while (0)\n", f);
}