feat(lnm): move request data to separate buffer if read buffer changes
All checks were successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/docker Pipeline was successful

This commit is contained in:
Jef Roosens 2023-12-22 20:06:06 +01:00
parent d53a949946
commit 8bdf52da0d
Signed by: Jef Roosens
GPG key ID: B75D4F293C7052DB
6 changed files with 88 additions and 24 deletions

View file

@ -8,7 +8,8 @@ lnm_http_step_err lander_remove_entry(lnm_http_conn *conn) {
lnm_http_loop_gctx *gctx = ctx->g;
lander_gctx *c_gctx = gctx->c;
const char *key_s = &ctx->req.path.s[ctx->req.path.groups[1].rm_so];
const char *key_s =
&ctx->req.buf.s[ctx->req.path.o + ctx->req.path.groups[1].rm_so];
int key_len = ctx->req.path.groups[1].rm_eo - ctx->req.path.groups[1].rm_so;
lsm_str *key;

View file

@ -118,7 +118,8 @@ lnm_http_step_err lander_get_entry(lnm_http_conn *conn) {
lnm_http_loop_gctx *gctx = ctx->g;
lander_gctx *c_gctx = gctx->c;
const char *key_s = &ctx->req.path.s[ctx->req.path.groups[1].rm_so];
const char *key_s =
&ctx->req.buf.s[ctx->req.path.o + ctx->req.path.groups[1].rm_so];
int key_len = ctx->req.path.groups[1].rm_eo - ctx->req.path.groups[1].rm_so;
lsm_str *key;

View file

@ -38,7 +38,8 @@ bool lander_insert_entry(lnm_http_loop_ctx *ctx) {
randomize_key(key_s, key_len);
lsm_str_init(&key, key_s);
} else {
const char *key_s = &ctx->req.path.s[ctx->req.path.groups[2].rm_so];
const char *key_s =
&ctx->req.buf.s[ctx->req.path.o + ctx->req.path.groups[2].rm_so];
key_len = ctx->req.path.groups[2].rm_eo - ctx->req.path.groups[2].rm_so;
lsm_str_init_copy_n(&key, key_s, key_len);