feat: implement new streecmp loose checking
This commit is contained in:
parent
3e7e1faef7
commit
55835087d3
14
parslib.c
14
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;
|
||||
}
|
||||
|
|
2
streecmp
2
streecmp
|
@ -1 +1 @@
|
|||
Subproject commit ca1293aa8f123adb91d80f687933ea5c596c114a
|
||||
Subproject commit 29d80f211dde476f138f984fd7199bb6b1365034
|
Loading…
Reference in New Issue
Block a user