Project homepage Mailing List  Warmcat.com  API Docs  Github Mirror 
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"", "gen_ut":1752331069, "reponame":"libwebsockets", "desc":"libwebsockets lightweight C networking library", "owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://libwebsockets.org/repo/libwebsockets", "f":3, "items": [ {"schema":"libjg2-1", "cid":"40b770333cffd72e7a4bdebd887af7a7", "commit": {"type":"commit", "time": 1630039872, "time_ofs": 60, "oid_tree": { "oid": "e185195743e9aa41268b1796ff543bf5e188bdae", "alias": []}, "oid":{ "oid": "a85b70bfe6f97431774f0f8045aee9608c4baa5c", "alias": []}, "msg": "http: hdr: sync lws_hdr_total_length with lws_hdr_copy", "sig_commit": { "git_time": { "time": 1630039872, "offset": 60 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }, "sig_author": { "git_time": { "time": 1630039651, "offset": 60 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }}, "body": "http: hdr: sync lws_hdr_total_length with lws_hdr_copy\n" , "diff": "diff --git a/lib/roles/http/parsers.c b/lib/roles/http/parsers.c\nindex cb405fd..fef1c47 100644\n--- a/lib/roles/http/parsers.c\n+++ b/lib/roles/http/parsers.c\n@@ -490,8 +490,8 @@ int lws_hdr_total_length(struct lws *wsi, enum lws_token_indexes h)\n \t\tlen +\u003d wsi-\u003ehttp.ah-\u003efrags[n].len;\n \t\tn \u003d wsi-\u003ehttp.ah-\u003efrags[n].nfrag;\n \n-\t\tif (n \u0026\u0026 h !\u003d WSI_TOKEN_HTTP_COOKIE)\n-\t\t\t++len;\n+\t\tif (n)\n+\t\t\tlen++;\n \n \t} while (n);\n \n@@ -532,9 +532,7 @@ int lws_hdr_copy_fragment(struct lws *wsi, char *dst, int len,\n int lws_hdr_copy(struct lws *wsi, char *dst, int len,\n \t\t\t enum lws_token_indexes h)\n {\n-\tint toklen \u003d lws_hdr_total_length(wsi, h);\n-\tint n;\n-\tint comma;\n+\tint toklen \u003d lws_hdr_total_length(wsi, h), n, comma;\n \n \t*dst \u003d '\u005c0';\n \tif (!toklen)\n@@ -548,7 +546,8 @@ int lws_hdr_copy(struct lws *wsi, char *dst, int len,\n \n \tn \u003d wsi-\u003ehttp.ah-\u003efrag_index[h];\n \tif (h \u003d\u003d WSI_TOKEN_HTTP_URI_ARGS)\n-\t\tlwsl_err(\u0022%s: WSI_TOKEN_HTTP_URI_ARGS start frag %d\u005cn\u0022, __func__, n);\n+\t\tlwsl_err(\u0022%s: WSI_TOKEN_HTTP_URI_ARGS start frag %d\u005cn\u0022,\n+\t\t\t\t__func__, n);\n \n \n \tif (!n)\n@@ -557,7 +556,10 @@ int lws_hdr_copy(struct lws *wsi, char *dst, int len,\n \t\tcomma \u003d (wsi-\u003ehttp.ah-\u003efrags[n].nfrag) ? 1 : 0;\n \n \t\tif (h \u003d\u003d WSI_TOKEN_HTTP_URI_ARGS)\n-\t\t\tlwsl_notice(\u0022%s: WSI_TOKEN_HTTP_URI_ARGS '%.*s'\u005cn\u0022, __func__, (int)wsi-\u003ehttp.ah-\u003efrags[n].len, \u0026wsi-\u003ehttp.ah-\u003edata[wsi-\u003ehttp.ah-\u003efrags[n].offset]);\n+\t\t\tlwsl_notice(\u0022%s: WSI_TOKEN_HTTP_URI_ARGS '%.*s'\u005cn\u0022,\n+\t\t\t\t __func__, (int)wsi-\u003ehttp.ah-\u003efrags[n].len,\n+\t\t\t\t \u0026wsi-\u003ehttp.ah-\u003edata[\n+\t\t\t\t wsi-\u003ehttp.ah-\u003efrags[n].offset]);\n \n \t\tif (wsi-\u003ehttp.ah-\u003efrags[n].len + comma \u003e\u003d len) {\n \t\t\tlwsl_notice(\u0022blowout len\u005cn\u0022);\n@@ -569,14 +571,22 @@ int lws_hdr_copy(struct lws *wsi, char *dst, int len,\n \t\tlen -\u003d wsi-\u003ehttp.ah-\u003efrags[n].len;\n \t\tn \u003d wsi-\u003ehttp.ah-\u003efrags[n].nfrag;\n \n+\t\t/*\n+\t\t * Note if you change this logic, take care about updating len\n+\t\t * and make sure lws_hdr_total_length() gives the same resulting\n+\t\t * length\n+\t\t */\n+\n \t\tif (comma) {\n-\t\t\tif (h \u003d\u003d WSI_TOKEN_HTTP_COOKIE || h \u003d\u003d WSI_TOKEN_HTTP_SET_COOKIE)\n+\t\t\tif (h \u003d\u003d WSI_TOKEN_HTTP_COOKIE ||\n+\t\t\t h \u003d\u003d WSI_TOKEN_HTTP_SET_COOKIE)\n \t\t\t\t*dst++ \u003d ';';\n \t\t\telse\n \t\t\t\tif (h \u003d\u003d WSI_TOKEN_HTTP_URI_ARGS)\n \t\t\t\t\t*dst++ \u003d '\u0026';\n \t\t\t\telse\n \t\t\t\t\t*dst++ \u003d ',';\n+\t\t\tlen--;\n \t\t}\n \t\t\t\t\n \t} while (n);\n","s":{"c":1752331069,"u": 4042}} ],"g": 4744,"chitpc": 0,"ehitpc": 0,"indexed":0 , "ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}