feat: implement new streecmp loose checking

This commit is contained in:
Kevin J. 2024-09-12 19:30:09 +02:00
parent 3e7e1faef7
commit 55835087d3
2 changed files with 11 additions and 5 deletions

View File

@ -102,12 +102,12 @@ int initres(void) {
return -1; return -1;
} }
ret = gentree(header_tree, headers, NULL); ret = gentree(header_tree, headers, NULL, LOOSE_CHECK);
if (ret < 0) { if (ret < 0) {
return -1; return -1;
} }
ret = gentree(method_tree, methods, NULL); ret = gentree(method_tree, methods, NULL, LOOSE_CHECK);
if (ret < 0) { if (ret < 0) {
return -1; return -1;
} }
@ -123,7 +123,9 @@ void fretres(void) {
void frepareq(struct httpareq *req) { void frepareq(struct httpareq *req) {
struct httitlereq *titl = &req->titl; struct httitlereq *titl = &req->titl;
free(titl->uri.er); free(titl->uri.er);
titl->uri.er = NULL;
free(titl->ver.er); free(titl->ver.er);
titl->uri.er = NULL;
for (int i = 0; i < header_count; i++) { for (int i = 0; i < header_count; i++) {
struct point *e = &req->hentries[i]; struct point *e = &req->hentries[i];
@ -132,13 +134,16 @@ void frepareq(struct httpareq *req) {
} }
free(e->er); free(e->er);
e->er = NULL;
} }
} }
void frepares(struct httpares *res) { void frepares(struct httpares *res) {
struct httitleres *titl = &res->titl; struct httitleres *titl = &res->titl;
free(titl->ver.er); free(titl->ver.er);
titl->ver.er = NULL;
free(titl->stxt.er); free(titl->stxt.er);
titl->stxt.er = NULL;
for (int i = 0; i < header_count; i++) { for (int i = 0; i < header_count; i++) {
struct point *e = &res->hentries[i]; struct point *e = &res->hentries[i];
@ -147,6 +152,7 @@ void frepares(struct httpares *res) {
} }
free(e->er); free(e->er);
e->er = NULL;
} }
} }
@ -186,7 +192,7 @@ int parshfield(char *offset, int len, struct point *hentries) {
} }
diff = htitle_lim-cursor; diff = htitle_lim-cursor;
ret = streencmp(header_tree, cursor, diff); ret = streencmp(header_tree, cursor, diff, LOOSE_CHECK);
if (!ret) { if (!ret) {
return 0; // skip it return 0; // skip it
} }
@ -280,7 +286,7 @@ int pareqtitl(char *offset, int len, struct httitlereq *titl) {
} }
diff = method_lim-cursor; diff = method_lim-cursor;
ret = streencmp(method_tree, cursor, diff); ret = streencmp(method_tree, cursor, diff, LOOSE_CHECK);
if (ret == 0) { if (ret == 0) {
return -1; return -1;
} }

@ -1 +1 @@
Subproject commit ca1293aa8f123adb91d80f687933ea5c596c114a Subproject commit 29d80f211dde476f138f984fd7199bb6b1365034