From 55835087d359f77d00030b3dffb1cd43980722ee Mon Sep 17 00:00:00 2001 From: Kevin Jerebica Date: Thu, 12 Sep 2024 19:30:09 +0200 Subject: [PATCH] feat: implement new streecmp loose checking --- parslib.c | 14 ++++++++++---- streecmp | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/parslib.c b/parslib.c index c6dedb1..afba6fc 100644 --- a/parslib.c +++ b/parslib.c @@ -102,12 +102,12 @@ int initres(void) { return -1; } - ret = gentree(header_tree, headers, NULL); + ret = gentree(header_tree, headers, NULL, LOOSE_CHECK); if (ret < 0) { return -1; } - ret = gentree(method_tree, methods, NULL); + ret = gentree(method_tree, methods, NULL, LOOSE_CHECK); if (ret < 0) { return -1; } @@ -123,7 +123,9 @@ void fretres(void) { void frepareq(struct httpareq *req) { struct httitlereq *titl = &req->titl; free(titl->uri.er); + titl->uri.er = NULL; free(titl->ver.er); + titl->uri.er = NULL; for (int i = 0; i < header_count; i++) { struct point *e = &req->hentries[i]; @@ -132,13 +134,16 @@ void frepareq(struct httpareq *req) { } free(e->er); + e->er = NULL; } } void frepares(struct httpares *res) { struct httitleres *titl = &res->titl; free(titl->ver.er); + titl->ver.er = NULL; free(titl->stxt.er); + titl->stxt.er = NULL; for (int i = 0; i < header_count; i++) { struct point *e = &res->hentries[i]; @@ -147,6 +152,7 @@ void frepares(struct httpares *res) { } free(e->er); + e->er = NULL; } } @@ -186,7 +192,7 @@ int parshfield(char *offset, int len, struct point *hentries) { } diff = htitle_lim-cursor; - ret = streencmp(header_tree, cursor, diff); + ret = streencmp(header_tree, cursor, diff, LOOSE_CHECK); if (!ret) { return 0; // skip it } @@ -280,7 +286,7 @@ int pareqtitl(char *offset, int len, struct httitlereq *titl) { } diff = method_lim-cursor; - ret = streencmp(method_tree, cursor, diff); + ret = streencmp(method_tree, cursor, diff, LOOSE_CHECK); if (ret == 0) { return -1; } diff --git a/streecmp b/streecmp index ca1293a..29d80f2 160000 --- a/streecmp +++ b/streecmp @@ -1 +1 @@ -Subproject commit ca1293aa8f123adb91d80f687933ea5c596c114a +Subproject commit 29d80f211dde476f138f984fd7199bb6b1365034