Commit 1054aede authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add the ungzip'ed length of verbatim sequences to the VEC string

so we can combine the CRC32 values.
parent 031976a0
...@@ -30,6 +30,9 @@ ...@@ -30,6 +30,9 @@
#define VEC_V1 (0x40 + 1) #define VEC_V1 (0x40 + 1)
#define VEC_V2 (0x40 + 2) #define VEC_V2 (0x40 + 2)
#define VEC_V8 (0x40 + 8) #define VEC_V8 (0x40 + 8)
#define VEC_C1 (0x50 + 1)
#define VEC_C2 (0x50 + 2)
#define VEC_C8 (0x50 + 8)
#define VEC_S1 (0x60 + 1) #define VEC_S1 (0x60 + 1)
#define VEC_S2 (0x60 + 2) #define VEC_S2 (0x60 + 2)
#define VEC_S8 (0x60 + 8) #define VEC_S8 (0x60 + 8)
......
...@@ -174,7 +174,7 @@ ESI_Deliver(struct sess *sp) ...@@ -174,7 +174,7 @@ ESI_Deliver(struct sess *sp)
struct storage *st; struct storage *st;
uint8_t *p, *e, *q, *r; uint8_t *p, *e, *q, *r;
unsigned off; unsigned off;
ssize_t l; ssize_t l, l_crc;
uint32_t crc, crc_ref; uint32_t crc, crc_ref;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
...@@ -192,6 +192,8 @@ ESI_Deliver(struct sess *sp) ...@@ -192,6 +192,8 @@ ESI_Deliver(struct sess *sp)
case VEC_V2: case VEC_V2:
case VEC_V8: case VEC_V8:
l = ved_decode_len(&p); l = ved_decode_len(&p);
assert(*p == VEC_C1 || *p == VEC_C2 || *p == VEC_C8);
l_crc = ved_decode_len(&p);
crc = vbe32dec(p); crc = vbe32dec(p);
p += 4; p += 4;
q = (void*)strchr((const char*)p, '\0'); q = (void*)strchr((const char*)p, '\0');
......
...@@ -280,6 +280,7 @@ vep_emit_verbatim(const struct vep_state *vep, ssize_t l) ...@@ -280,6 +280,7 @@ vep_emit_verbatim(const struct vep_state *vep, ssize_t l)
Debug("---> VERBATIM(%jd)\n", (intmax_t)l); Debug("---> VERBATIM(%jd)\n", (intmax_t)l);
} }
vep_emit_len(vep, l, VEC_V1, VEC_V2, VEC_V8); vep_emit_len(vep, l, VEC_V1, VEC_V2, VEC_V8);
vep_emit_len(vep, l, VEC_C1, VEC_C2, VEC_C8);
vbe32enc(buf, vep->crc); vbe32enc(buf, vep->crc);
vsb_bcat(vep->vsb, buf, sizeof buf); vsb_bcat(vep->vsb, buf, sizeof buf);
vsb_printf(vep->vsb, "%lx\r\n%c", l, 0); vsb_printf(vep->vsb, "%lx\r\n%c", l, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment