Project homepage Mailing List  Warmcat.com  API Docs  Github Mirror 
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"", "gen_ut":1713477675, "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":"c4e7d3d547ca759c2b01df9267a62f08", "commit": {"type":"commit", "time": 1524813656, "time_ofs": 480, "oid_tree": { "oid": "d3554a854037a6c2c7d251bb9e4486fe59226369", "alias": []}, "oid":{ "oid": "16a907180c462af383866a426ad9b56568f0a34f", "alias": []}, "msg": "refactor: move all ah and http specific vars to http private and conditional inclusion from th", "sig_commit": { "git_time": { "time": 1524813656, "offset": 480 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }, "sig_author": { "git_time": { "time": 1524813656, "offset": 480 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }}, "body": "refactor: move all ah and http specific vars to http private and conditional inclusion from there" , "diff": "diff --git a/CMakeLists.txt b/CMakeLists.txt\nindex b545af3..79223f4 100644\n--- a/CMakeLists.txt\n+++ b/CMakeLists.txt\n@@ -9,7 +9,7 @@ set(LWS_WITH_BUNDLED_ZLIB_DEFAULT OFF)\n if(WIN32)\n \tset(LWS_WITH_BUNDLED_ZLIB_DEFAULT ON)\n endif()\n-set(LWS_ROLE_H1 1)\n+\n set(LWS_ROLE_RAW 1)\n \n #\n@@ -20,6 +20,7 @@ option(LWS_WITH_DISTRO_RECOMMENDED \u0022Enable features recommended for distro packa\n #\n # Major individual features\n #\n+option(LWS_ROLE_H1 \u0022Compile with support for http/1 (needed for ws)\u0022 ON)\n option(LWS_ROLE_WS \u0022Compile with support for websockets\u0022 ON)\n option(LWS_WITH_HTTP2 \u0022Compile with server support for HTTP/2\u0022 OFF)\n option(LWS_WITH_LWSWS \u0022Libwebsockets Webserver\u0022 OFF)\ndiff --git a/lib/context.c b/lib/context.c\nindex ad79b28..6ae8029 100644\n--- a/lib/context.c\n+++ b/lib/context.c\n@@ -560,7 +560,9 @@ lws_create_vhost(struct lws_context *context,\n \telse\n \t\tvh-\u003ename \u003d info-\u003evhost_name;\n \n-\tvh-\u003eerror_document_404 \u003d info-\u003eerror_document_404;\n+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)\n+\tvh-\u003ehttp.error_document_404 \u003d info-\u003eerror_document_404;\n+#endif\n \n \tif (info-\u003eoptions \u0026 LWS_SERVER_OPTION_ONLY_RAW)\n \t\tlwsl_info(\u0022%s set to only support RAW\u005cn\u0022, vh-\u003ename);\n@@ -684,8 +686,9 @@ lws_create_vhost(struct lws_context *context,\n \tvh-\u003esame_vh_protocol_list \u003d (struct lws **)\n \t\t\tlws_zalloc(sizeof(struct lws *) * vh-\u003ecount_protocols,\n \t\t\t\t \u0022same vh list\u0022);\n-\n-\tvh-\u003emount_list \u003d info-\u003emounts;\n+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)\n+\tvh-\u003ehttp.mount_list \u003d info-\u003emounts;\n+#endif\n \n #ifdef LWS_WITH_UNIX_SOCK\n \tif (LWS_UNIX_SOCK_ENABLED(context)) {\n@@ -736,22 +739,26 @@ lws_create_vhost(struct lws_context *context,\n \t}\n \n \tvh-\u003elisten_port \u003d info-\u003eport;\n-\tvh-\u003ehttp_proxy_port \u003d 0;\n-\tvh-\u003ehttp_proxy_address[0] \u003d '\u005c0';\n+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)\n+\tvh-\u003ehttp.http_proxy_port \u003d 0;\n+\tvh-\u003ehttp.http_proxy_address[0] \u003d '\u005c0';\n+#endif\n #if defined(LWS_WITH_SOCKS5)\n \tvh-\u003esocks_proxy_port \u003d 0;\n \tvh-\u003esocks_proxy_address[0] \u003d '\u005c0';\n #endif\n \n \t/* either use proxy from info, or try get it from env var */\n-\n+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)\n \t/* http proxy */\n \tif (info-\u003ehttp_proxy_address) {\n \t\t/* override for backwards compatibility */\n \t\tif (info-\u003ehttp_proxy_port)\n-\t\t\tvh-\u003ehttp_proxy_port \u003d info-\u003ehttp_proxy_port;\n+\t\t\tvh-\u003ehttp.http_proxy_port \u003d info-\u003ehttp_proxy_port;\n \t\tlws_set_proxy(vh, info-\u003ehttp_proxy_address);\n-\t} else {\n+\t} else\n+#endif\n+\t{\n #ifdef LWS_HAVE_GETENV\n \t\tp \u003d getenv(\u0022http_proxy\u0022);\n \t\tif (p)\n@@ -1143,8 +1150,8 @@ lws_create_context(const struct lws_context_creation_info *info)\n \t\tcontext-\u003ept[n].context \u003d context;\n #endif\n \t\tcontext-\u003ept[n].tid \u003d n;\n-\t\tcontext-\u003ept[n].ah_list \u003d NULL;\n-\t\tcontext-\u003ept[n].ah_pool_length \u003d 0;\n+\t\tcontext-\u003ept[n].http.ah_list \u003d NULL;\n+\t\tcontext-\u003ept[n].http.ah_pool_length \u003d 0;\n \n \t\tlws_pt_mutex_init(\u0026context-\u003ept[n]);\n \t}\n@@ -1716,8 +1723,8 @@ lws_context_destroy(struct lws_context *context)\n \n \t\tlws_free_set_NULL(context-\u003ept[n].serv_buf);\n \n-\t\twhile (pt-\u003eah_list)\n-\t\t\t_lws_destroy_ah(pt, pt-\u003eah_list);\n+\t\twhile (pt-\u003ehttp.ah_list)\n+\t\t\t_lws_destroy_ah(pt, pt-\u003ehttp.ah_list);\n \t}\n \tlws_plat_context_early_destroy(context);\n \ndiff --git a/lib/libwebsockets.c b/lib/libwebsockets.c\nindex 0be9b13..f883f0a 100644\n--- a/lib/libwebsockets.c\n+++ b/lib/libwebsockets.c\n@@ -104,13 +104,13 @@ __lws_free_wsi(struct lws *wsi)\n \tif (wsi-\u003evhost \u0026\u0026 wsi-\u003evhost-\u003elserv_wsi \u003d\u003d wsi)\n \t\twsi-\u003evhost-\u003elserv_wsi \u003d NULL;\n \n-\tah \u003d pt-\u003eah_list;\n+\tah \u003d pt-\u003ehttp.ah_list;\n \twhile (ah) {\n \t\tif (ah-\u003ein_use \u0026\u0026 ah-\u003ewsi \u003d\u003d wsi) {\n \t\t\tlwsl_err(\u0022%s: ah leak: wsi %p\u005cn\u0022, __func__, wsi);\n \t\t\tah-\u003ein_use \u003d 0;\n \t\t\tah-\u003ewsi \u003d NULL;\n-\t\t\tpt-\u003eah_count_in_use--;\n+\t\t\tpt-\u003ehttp.ah_count_in_use--;\n \t\t\tbreak;\n \t\t}\n \t\tah \u003d ah-\u003enext;\n@@ -1740,24 +1740,25 @@ lws_set_proxy(struct lws_vhost *vhost, const char *proxy)\n \t} else\n \t\tvhost-\u003eproxy_basic_auth_token[0] \u003d '\u005c0';\n \n-\tlws_strncpy(vhost-\u003ehttp_proxy_address, proxy,\n-\t\t sizeof(vhost-\u003ehttp_proxy_address));\n+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)\n+\tlws_strncpy(vhost-\u003ehttp.http_proxy_address, proxy,\n+\t\t sizeof(vhost-\u003ehttp.http_proxy_address));\n \n-\tp \u003d strchr(vhost-\u003ehttp_proxy_address, ':');\n-\tif (!p \u0026\u0026 !vhost-\u003ehttp_proxy_port) {\n+\tp \u003d strchr(vhost-\u003ehttp.http_proxy_address, ':');\n+\tif (!p \u0026\u0026 !vhost-\u003ehttp.http_proxy_port) {\n \t\tlwsl_err(\u0022http_proxy needs to be ads:port\u005cn\u0022);\n \n \t\treturn -1;\n \t} else {\n \t\tif (p) {\n \t\t\t*p \u003d '\u005c0';\n-\t\t\tvhost-\u003ehttp_proxy_port \u003d atoi(p + 1);\n+\t\t\tvhost-\u003ehttp.http_proxy_port \u003d atoi(p + 1);\n \t\t}\n \t}\n \n-\tlwsl_info(\u0022 Proxy %s:%u\u005cn\u0022, vhost-\u003ehttp_proxy_address,\n-\t\t\tvhost-\u003ehttp_proxy_port);\n-\n+\tlwsl_info(\u0022 Proxy %s:%u\u005cn\u0022, vhost-\u003ehttp.http_proxy_address,\n+\t\t\tvhost-\u003ehttp.http_proxy_port);\n+#endif\n \treturn 0;\n \n auth_too_long:\n@@ -2991,9 +2992,9 @@ lws_json_dump_vhost(const struct lws_vhost *vh, char *buf, int len)\n \t\t\tvh-\u003econn_stats.h2_alpn,\n \t\t\tvh-\u003econn_stats.h2_subs\n \t);\n-\n-\tif (vh-\u003emount_list) {\n-\t\tconst struct lws_http_mount *m \u003d vh-\u003emount_list;\n+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)\n+\tif (vh-\u003ehttp.mount_list) {\n+\t\tconst struct lws_http_mount *m \u003d vh-\u003ehttp.mount_list;\n \n \t\tbuf +\u003d lws_snprintf(buf, end - buf, \u0022,\u005cn \u005c\u0022mounts\u005c\u0022:[\u0022);\n \t\twhile (m) {\n@@ -3024,7 +3025,7 @@ lws_json_dump_vhost(const struct lws_vhost *vh, char *buf, int len)\n \t\t}\n \t\tbuf +\u003d lws_snprintf(buf, end - buf, \u0022\u005cn ]\u0022);\n \t}\n-\n+#endif\n \tif (vh-\u003eprotocols) {\n \t\tn \u003d 0;\n \t\tfirst \u003d 1;\n@@ -3117,8 +3118,8 @@ lws_json_dump_context(const struct lws_context *context, char *buf, int len,\n \t\t\t\t\u0022 \u005c\u0022ah_wait_list\u005c\u0022:\u005c\u0022%d\u005c\u0022\u005cn\u0022\n \t\t\t\t\u0022 }\u0022,\n \t\t\t\tpt-\u003efds_count,\n-\t\t\t\tpt-\u003eah_count_in_use,\n-\t\t\t\tpt-\u003eah_wait_list_length);\n+\t\t\t\tpt-\u003ehttp.ah_count_in_use,\n+\t\t\t\tpt-\u003ehttp.ah_wait_list_length);\n \t}\n \n \tbuf +\u003d lws_snprintf(buf, end - buf, \u0022]\u0022);\n@@ -3169,7 +3170,7 @@ lws_json_dump_context(const struct lws_context *context, char *buf, int len,\n #ifdef LWS_WITH_CGI\n \tfor (n \u003d 0; n \u003c context-\u003ecount_threads; n++) {\n \t\tpt \u003d \u0026context-\u003ept[n];\n-\t\tpcgi \u003d \u0026pt-\u003ecgi_list;\n+\t\tpcgi \u003d \u0026pt-\u003ehttp.cgi_list;\n \n \t\twhile (*pcgi) {\n \t\t\tpcgi \u003d \u0026(*pcgi)-\u003ecgi_list;\n@@ -3343,17 +3344,17 @@ lws_stats_log_dump(struct lws_context *context)\n \t\tlws_pt_lock(pt, __func__);\n \n \t\tlwsl_notice(\u0022 AH in use / max: %d / %d\u005cn\u0022,\n-\t\t\t\tpt-\u003eah_count_in_use,\n+\t\t\t\tpt-\u003ehttp.ah_count_in_use,\n \t\t\t\tcontext-\u003emax_http_header_pool);\n \n-\t\twl \u003d pt-\u003eah_wait_list;\n+\t\twl \u003d pt-\u003ehttp.ah_wait_list;\n \t\twhile (wl) {\n \t\t\tm++;\n \t\t\twl \u003d wl-\u003eah_wait_list;\n \t\t}\n \n \t\tlwsl_notice(\u0022 AH wait list count / actual: %d / %d\u005cn\u0022,\n-\t\t\t\tpt-\u003eah_wait_list_length, m);\n+\t\t\t\tpt-\u003ehttp.ah_wait_list_length, m);\n \n \t\tlws_pt_unlock(pt);\n \t}\n@@ -3384,9 +3385,13 @@ lws_stats_log_dump(struct lws_context *context)\n \t\t\t\tif (!lws_plat_inet_ntop(df-\u003eaf, df-\u003eaddr, buf,\n \t\t\t\t\t\t\tsizeof(buf) - 1))\n \t\t\t\t\tstrcpy(buf, \u0022unknown\u0022);\n-\n+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)\n \t\t\t\tlwsl_notice(\u0022 peer %s: count wsi: %d, count ah: %d\u005cn\u0022,\n \t\t\t\t\t buf, df-\u003ecount_wsi, df-\u003ecount_ah);\n+#else\n+\t\t\t\tlwsl_notice(\u0022 peer %s: count wsi: %d\u005cn\u0022,\n+\t\t\t\t\t buf, df-\u003ecount_wsi);\n+#endif\n \n \t\t\t\tif (!--m)\n \t\t\t\t\tbreak;\ndiff --git a/lib/misc/peer-limits.c b/lib/misc/peer-limits.c\nindex 2fcb8bb..741505c 100644\n--- a/lib/misc/peer-limits.c\n+++ b/lib/misc/peer-limits.c\n@@ -210,7 +210,11 @@ lws_peer_track_wsi_close(struct lws_context *context, struct lws_peer *peer)\n \tassert(peer-\u003ecount_wsi);\n \tpeer-\u003ecount_wsi--;\n \n-\tif (!peer-\u003ecount_wsi \u0026\u0026 !peer-\u003ecount_ah) {\n+\tif (!peer-\u003ecount_wsi\n+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)\n+\t\t\t\u0026\u0026 !peer-\u003ehttp.count_ah\n+#endif\n+\t) {\n \t\t/*\n \t\t * in order that we can accumulate peer activity correctly\n \t\t * allowing for periods when the peer has no connections,\n@@ -226,13 +230,14 @@ lws_peer_track_wsi_close(struct lws_context *context, struct lws_peer *peer)\n \tlws_context_unlock(context); /* \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003e */\n }\n \n+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)\n int\n lws_peer_confirm_ah_attach_ok(struct lws_context *context, struct lws_peer *peer)\n {\n \tif (!peer)\n \t\treturn 0;\n \n-\tif (context-\u003eip_limit_ah \u0026\u0026 peer-\u003ecount_ah \u003e\u003d context-\u003eip_limit_ah) {\n+\tif (context-\u003eip_limit_ah \u0026\u0026 peer-\u003ehttp.count_ah \u003e\u003d context-\u003eip_limit_ah) {\n \t\tlwsl_info(\u0022peer reached ah limit %d, deferring\u005cn\u0022,\n \t\t\t\tcontext-\u003eip_limit_ah);\n \n@@ -249,8 +254,8 @@ lws_peer_track_ah_detach(struct lws_context *context, struct lws_peer *peer)\n \t\treturn;\n \n \tlws_context_lock(context); /* \u003c\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d */\n-\tassert(peer-\u003ecount_ah);\n-\tpeer-\u003ecount_ah--;\n+\tassert(peer-\u003ehttp.count_ah);\n+\tpeer-\u003ehttp.count_ah--;\n \tlws_context_unlock(context); /* \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003e */\n }\n-\n+#endif\ndiff --git a/lib/private-libwebsockets.h b/lib/private-libwebsockets.h\nindex c488950..f514d1f 100644\n--- a/lib/private-libwebsockets.h\n+++ b/lib/private-libwebsockets.h\n@@ -779,25 +779,26 @@ struct lws_context_per_thread {\n #endif\n \tstruct lws_pollfd *fds;\n \tvolatile struct lws_foreign_thread_pollfd * volatile foreign_pfd_list;\n+\n #if defined(LWS_ROLE_WS) \u0026\u0026 !defined(LWS_WITHOUT_EXTENSIONS)\n \tstruct lws_pt_role_ws ws;\n #endif\n+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)\n+\tstruct lws_pt_role_http http;\n+#endif\n+\n \tstruct lws_dll_lws dll_head_timeout;\n \tstruct lws_dll_lws dll_head_hrtimer;\n \tstruct lws_dll_lws dll_head_buflist; /* guys with pending rxflow */\n #if defined(LWS_WITH_LIBUV) || defined(LWS_WITH_LIBEVENT)\n \tstruct lws_context *context;\n #endif\n-#ifdef LWS_WITH_CGI\n-\tstruct lws_cgi *cgi_list;\n-#endif\n-\tvoid *http_header_data;\n-\tstruct allocated_headers *ah_list;\n-\tstruct lws *ah_wait_list;\n+\n+\n #if defined(LWS_HAVE_PTHREAD_H)\n \tconst char *last_lock_reason;\n #endif\n-\tint ah_wait_list_length;\n+\n #if defined(LWS_WITH_TLS)\n \tstruct lws *pending_read_list; /* linked list */\n #endif\n@@ -837,9 +838,7 @@ struct lws_context_per_thread {\n \tvolatile unsigned char foreign_spinlock;\n \n \tunsigned int fds_count;\n-\tuint32_t ah_pool_length;\n \n-\tshort ah_count_in_use;\n \tunsigned char tid;\n \tunsigned char lock_depth;\n #if LWS_MAX_SMP \u003e 1\n@@ -889,7 +888,6 @@ struct alpn_ctx {\n };\n \n struct lws_vhost {\n-\tchar http_proxy_address[128];\n \tchar proxy_basic_auth_token[128];\n #if LWS_MAX_SMP \u003e 1\n \tpthread_mutex_t lock;\n@@ -898,6 +896,9 @@ struct lws_vhost {\n #if defined(LWS_ROLE_H2)\n \tstruct lws_vhost_role_h2 h2;\n #endif\n+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)\n+\tstruct lws_vhost_role_http http;\n+#endif\n #if defined(LWS_ROLE_WS) \u0026\u0026 !defined(LWS_WITHOUT_EXTENSIONS)\n \tstruct lws_vhost_role_ws ws;\n #endif\n@@ -913,7 +914,7 @@ struct lws_vhost {\n \tstruct lws_conn_stats conn_stats;\n \tstruct lws_context *context;\n \tstruct lws_vhost *vhost_next;\n-\tconst struct lws_http_mount *mount_list;\n+\n \tstruct lws *lserv_wsi;\n \tconst char *name;\n \tconst char *iface;\n@@ -931,7 +932,7 @@ struct lws_vhost {\n #if !defined(LWS_NO_CLIENT)\n \tstruct lws_dll_lws dll_active_client_conns;\n #endif\n-\tconst char *error_document_404;\n+\n \tconst char *alpn;\n #if defined(LWS_WITH_TLS)\n \tlws_tls_ctx *ssl_ctx;\n@@ -948,7 +949,7 @@ struct lws_vhost {\n \tvoid *user;\n \n \tint listen_port;\n-\tunsigned int http_proxy_port;\n+\n #if defined(LWS_WITH_SOCKS5)\n \tunsigned int socks_proxy_port;\n #endif\n@@ -1005,10 +1006,11 @@ struct lws_peer {\n \tuint8_t addr[32];\n \tuint32_t hash;\n \tuint32_t count_wsi;\n-\tuint32_t count_ah;\n-\n \tuint32_t total_wsi;\n-\tuint32_t total_ah;\n+\n+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)\n+\tstruct lws_peer_role_http http;\n+#endif\n \n \tuint8_t af;\n };\n@@ -1420,8 +1422,7 @@ struct lws {\n #if defined(LWS_WITH_PEER_LIMITS)\n \tstruct lws_peer *peer;\n #endif\n-\tstruct allocated_headers *ah;\n-\tstruct lws *ah_wait_list;\n+\n \tstruct lws_udp *udp;\n #ifndef LWS_NO_CLIENT\n \tstruct client_info_stash *stash;\ndiff --git a/lib/roles/cgi/cgi-server.c b/lib/roles/cgi/cgi-server.c\nindex 8863f0e..b5c1d19 100644\n--- a/lib/roles/cgi/cgi-server.c\n+++ b/lib/roles/cgi/cgi-server.c\n@@ -188,8 +188,8 @@ lws_cgi(struct lws *wsi, const char * const *exec_array, int script_uri_path_len\n \n \t/* add us to the pt list of active cgis */\n \tlwsl_debug(\u0022%s: adding cgi %p to list\u005cn\u0022, __func__, wsi-\u003ecgi);\n-\tcgi-\u003ecgi_list \u003d pt-\u003ecgi_list;\n-\tpt-\u003ecgi_list \u003d cgi;\n+\tcgi-\u003ecgi_list \u003d pt-\u003ehttp.cgi_list;\n+\tpt-\u003ehttp.cgi_list \u003d cgi;\n \n \tsum +\u003d lws_snprintf(sum, sumend - sum, \u0022%s \u0022, exec_array[0]);\n \n@@ -199,7 +199,7 @@ lws_cgi(struct lws *wsi, const char * const *exec_array, int script_uri_path_len\n \n \tif (lws_is_ssl(wsi))\n \t\tenv_array[n++] \u003d \u0022HTTPS\u003dON\u0022;\n-\tif (wsi-\u003eah) {\n+\tif (wsi-\u003ehttp.ah) {\n \t\tstatic const unsigned char meths[] \u003d {\n \t\t\tWSI_TOKEN_GET_URI,\n \t\t\tWSI_TOKEN_POST_URI,\n@@ -442,7 +442,7 @@ lws_cgi(struct lws *wsi, const char * const *exec_array, int script_uri_path_len\n \n bail3:\n \t/* drop us from the pt cgi list */\n-\tpt-\u003ecgi_list \u003d cgi-\u003ecgi_list;\n+\tpt-\u003ehttp.cgi_list \u003d cgi-\u003ecgi_list;\n \n \twhile (--n \u003e\u003d 0)\n \t\t__remove_wsi_socket_from_fds(wsi-\u003ecgi-\u003estdwsi[n]);\n@@ -961,7 +961,7 @@ lws_cgi_kill_terminated(struct lws_context_per_thread *pt)\n \t\t\tcontinue;\n \t\tlwsl_debug(\u0022%s: observed PID %d terminated\u005cn\u0022, __func__, n);\n \n-\t\tpcgi \u003d \u0026pt-\u003ecgi_list;\n+\t\tpcgi \u003d \u0026pt-\u003ehttp.cgi_list;\n \n \t\t/* check all the subprocesses on the cgi list */\n \t\twhile (*pcgi) {\n@@ -1023,7 +1023,7 @@ lws_cgi_kill_terminated(struct lws_context_per_thread *pt)\n \t\t}\n \t}\n \n-\tpcgi \u003d \u0026pt-\u003ecgi_list;\n+\tpcgi \u003d \u0026pt-\u003ehttp.cgi_list;\n \n \t/* check all the subprocesses on the cgi list */\n \twhile (*pcgi) {\n@@ -1095,7 +1095,7 @@ void\n lws_cgi_remove_and_kill(struct lws *wsi)\n {\n \tstruct lws_context_per_thread *pt \u003d \u0026wsi-\u003econtext-\u003ept[(int)wsi-\u003etsi];\n-\tstruct lws_cgi **pcgi \u003d \u0026pt-\u003ecgi_list;\n+\tstruct lws_cgi **pcgi \u003d \u0026pt-\u003ehttp.cgi_list;\n \n \t/* remove us from the cgi list */\n \tlwsl_debug(\u0022%s: remove cgi %p from list\u005cn\u0022, __func__, wsi-\u003ecgi);\ndiff --git a/lib/roles/h1/ops-h1.c b/lib/roles/h1/ops-h1.c\nindex 9a4694f..5fa929a 100644\n--- a/lib/roles/h1/ops-h1.c\n+++ b/lib/roles/h1/ops-h1.c\n@@ -62,7 +62,7 @@ lws_read_h1(struct lws *wsi, unsigned char *buf, lws_filepos_t len)\n \t\t/* fallthru */\n \n \tcase LRS_HEADERS:\n-\t\tif (!wsi-\u003eah) {\n+\t\tif (!wsi-\u003ehttp.ah) {\n \t\t\tlwsl_err(\u0022%s: LRS_HEADERS: NULL ah\u005cn\u0022, __func__);\n \t\t\tassert(0);\n \t\t}\n@@ -308,7 +308,7 @@ lws_h1_server_socket_service(struct lws *wsi, struct lws_pollfd *pollfd)\n \t lwsi_state(wsi) \u003d\u003d LRS_ISSUING_FILE ||\n \t lwsi_state(wsi) \u003d\u003d LRS_HEADERS ||\n \t lwsi_state(wsi) \u003d\u003d LRS_BODY)) {\n-\t\tif (!wsi-\u003eah \u0026\u0026\n+\t\tif (!wsi-\u003ehttp.ah \u0026\u0026\n \t\t lws_header_table_attach(wsi, 0)) {\n \t\t\tlwsl_info(\u0022wsi %p: ah get fail\u005cn\u0022, wsi);\n \t\t\tgoto try_pollout;\n@@ -367,7 +367,7 @@ lws_h1_server_socket_service(struct lws *wsi, struct lws_pollfd *pollfd)\n \t\t * so the ah has no further meaning\n \t\t */\n \n-\t\tif (wsi-\u003eah \u0026\u0026\n+\t\tif (wsi-\u003ehttp.ah \u0026\u0026\n \t\t !lwsi_role_h1(wsi) \u0026\u0026\n \t\t !lwsi_role_h2(wsi) \u0026\u0026\n \t\t !lwsi_role_cgi(wsi))\ndiff --git a/lib/roles/h2/hpack.c b/lib/roles/h2/hpack.c\nindex 2147c65..6e80276 100644\n--- a/lib/roles/h2/hpack.c\n+++ b/lib/roles/h2/hpack.c\n@@ -202,7 +202,7 @@ static int huftable_decode(int pos, char c)\n \n static int lws_frag_start(struct lws *wsi, int hdr_token_idx)\n {\n-\tstruct allocated_headers *ah \u003d wsi-\u003eah;\n+\tstruct allocated_headers *ah \u003d wsi-\u003ehttp.ah;\n \n \tif (!ah) {\n \t\tlwsl_notice(\u0022%s: no ah\u005cn\u0022, __func__);\n@@ -275,7 +275,7 @@ static int lws_frag_start(struct lws *wsi, int hdr_token_idx)\n \n static int lws_frag_append(struct lws *wsi, unsigned char c)\n {\n-\tstruct allocated_headers *ah \u003d wsi-\u003eah;\n+\tstruct allocated_headers *ah \u003d wsi-\u003ehttp.ah;\n \n \tah-\u003edata[ah-\u003epos++] \u003d c;\n \tah-\u003efrags[ah-\u003enfrag].len++;\n@@ -290,16 +290,16 @@ static int lws_frag_end(struct lws *wsi)\n \t\treturn 1;\n \n \t/* don't account for the terminating NUL in the logical length */\n-\twsi-\u003eah-\u003efrags[wsi-\u003eah-\u003enfrag].len--;\n+\twsi-\u003ehttp.ah-\u003efrags[wsi-\u003ehttp.ah-\u003enfrag].len--;\n \n-\twsi-\u003eah-\u003enfrag++;\n+\twsi-\u003ehttp.ah-\u003enfrag++;\n \treturn 0;\n }\n \n int\n lws_hdr_extant(struct lws *wsi, enum lws_token_indexes h)\n {\n-\tstruct allocated_headers *ah \u003d wsi-\u003eah;\n+\tstruct allocated_headers *ah \u003d wsi-\u003ehttp.ah;\n \tint n;\n \n \tif (!ah)\n@@ -781,7 +781,7 @@ int lws_hpack_interpret(struct lws *wsi, unsigned char c)\n {\n \tstruct lws *nwsi \u003d lws_get_network_wsi(wsi);\n \tstruct lws_h2_netconn *h2n \u003d nwsi-\u003eh2.h2n;\n-\tstruct allocated_headers *ah \u003d wsi-\u003eah;\n+\tstruct allocated_headers *ah \u003d wsi-\u003ehttp.ah;\n \tunsigned int prev;\n \tunsigned char c1;\n \tint n, m, plen;\ndiff --git a/lib/roles/h2/http2.c b/lib/roles/h2/http2.c\nindex b0a4557..c61eb84 100644\n--- a/lib/roles/h2/http2.c\n+++ b/lib/roles/h2/http2.c\n@@ -672,11 +672,11 @@ int lws_h2_do_pps_send(struct lws *wsi)\n \t\t\t\tgoto bail;\n \n \t\t\t/* pass on the initial headers to SID 1 */\n-\t\t\th2n-\u003eswsi-\u003eah \u003d wsi-\u003eah;\n-\t\t\twsi-\u003eah \u003d NULL;\n+\t\t\th2n-\u003eswsi-\u003ehttp.ah \u003d wsi-\u003ehttp.ah;\n+\t\t\twsi-\u003ehttp.ah \u003d NULL;\n \n \t\t\tlwsl_info(\u0022%s: inherited headers %p\u005cn\u0022, __func__,\n-\t\t\t\t h2n-\u003eswsi-\u003eah);\n+\t\t\t\t h2n-\u003eswsi-\u003ehttp.ah);\n \t\t\th2n-\u003eswsi-\u003eh2.tx_cr \u003d\n \t\t\t\th2n-\u003eset.s[H2SET_INITIAL_WINDOW_SIZE];\n \t\t\tlwsl_info(\u0022initial tx credit on conn %p: %d\u005cn\u0022,\n@@ -1090,7 +1090,7 @@ lws_h2_parse_frame_header(struct lws *wsi)\n \t\t * ah needs attaching to child wsi, even though\n \t\t * we only fill it from network wsi\n \t\t */\n-\t\tif (!h2n-\u003eswsi-\u003eah)\n+\t\tif (!h2n-\u003eswsi-\u003ehttp.ah)\n \t\t\tif (lws_header_table_attach(h2n-\u003eswsi, 0)) {\n \t\t\t\tlwsl_err(\u0022%s: Failed to get ah\u005cn\u0022, __func__);\n \t\t\t\treturn 1;\n@@ -1230,7 +1230,7 @@ lws_h2_parse_end_of_frame(struct lws *wsi)\n \t\t\t\t\t \u0026role_ops_h2);\n \n \t\t\t/* pass on the initial headers to SID 1 */\n-\t\t\th2n-\u003eswsi-\u003eah \u003d wsi-\u003eah;\n+\t\t\th2n-\u003eswsi-\u003ehttp.ah \u003d wsi-\u003ehttp.ah;\n \t\t\th2n-\u003eswsi-\u003eclient_h2_substream \u003d 1;\n \n \t\t\th2n-\u003eswsi-\u003eprotocol \u003d wsi-\u003eprotocol;\n@@ -1240,9 +1240,9 @@ lws_h2_parse_end_of_frame(struct lws *wsi)\n \n \t\t\twsi-\u003euser_space \u003d NULL;\n \n-\t\t\tif (h2n-\u003eswsi-\u003eah)\n-\t\t\t\th2n-\u003eswsi-\u003eah-\u003ewsi \u003d h2n-\u003eswsi;\n-\t\t\twsi-\u003eah \u003d NULL;\n+\t\t\tif (h2n-\u003eswsi-\u003ehttp.ah)\n+\t\t\t\th2n-\u003eswsi-\u003ehttp.ah-\u003ewsi \u003d h2n-\u003eswsi;\n+\t\t\twsi-\u003ehttp.ah \u003d NULL;\n \n \t\t\tlwsl_info(\u0022%s: MIGRATING nwsi %p: swsi %p\u005cn\u0022, __func__,\n \t\t\t\t wsi, h2n-\u003eswsi);\n@@ -1422,8 +1422,8 @@ lws_h2_parse_end_of_frame(struct lws *wsi)\n \t\twsi-\u003evhost-\u003econn_stats.h2_trans++;\n \t\tp \u003d lws_hdr_simple_ptr(h2n-\u003eswsi, WSI_TOKEN_HTTP_COLON_METHOD);\n \t\tif (!strcmp(p, \u0022POST\u0022))\n-\t\t\th2n-\u003eswsi-\u003eah-\u003efrag_index[WSI_TOKEN_POST_URI] \u003d\n-\t\t\t\th2n-\u003eswsi-\u003eah-\u003efrag_index[WSI_TOKEN_HTTP_COLON_PATH];\n+\t\t\th2n-\u003eswsi-\u003ehttp.ah-\u003efrag_index[WSI_TOKEN_POST_URI] \u003d\n+\t\t\t\th2n-\u003eswsi-\u003ehttp.ah-\u003efrag_index[WSI_TOKEN_HTTP_COLON_PATH];\n \n \t\tlwsl_debug(\u0022%s: setting DEF_ACT from 0x%x\u005cn\u0022, __func__, h2n-\u003eswsi-\u003ewsistate);\n \t\tlwsi_set_state(h2n-\u003eswsi, LRS_DEFERRING_ACTION);\ndiff --git a/lib/roles/h2/ops-h2.c b/lib/roles/h2/ops-h2.c\nindex f11b461..8aeb167 100644\n--- a/lib/roles/h2/ops-h2.c\n+++ b/lib/roles/h2/ops-h2.c\n@@ -288,7 +288,7 @@ drain:\n \n \t// lws_buflist_describe(\u0026wsi-\u003ebuflist, wsi);\n \n-\tif (wsi-\u003eah\n+\tif (wsi-\u003ehttp.ah\n #if !defined(LWS_NO_CLIENT)\n \t\t\t\u0026\u0026 !wsi-\u003eclient_h2_alpn\n #endif\n@@ -1000,13 +1000,13 @@ rops_alpn_negotiated_h2(struct lws *wsi, const char *alpn)\n \n \t\t/* adopt the header info */\n \n-\t\tah \u003d wsi-\u003eah;\n+\t\tah \u003d wsi-\u003ehttp.ah;\n \n \t\tlws_role_transition(wsi, LWSIFR_SERVER, LRS_H2_AWAIT_PREFACE,\n \t\t\t\t \u0026role_ops_h2);\n \n \t\t/* http2 union member has http union struct at start */\n-\t\twsi-\u003eah \u003d ah;\n+\t\twsi-\u003ehttp.ah \u003d ah;\n \n \t\tif (!wsi-\u003eh2.h2n)\n \t\t\twsi-\u003eh2.h2n \u003d lws_zalloc(sizeof(*wsi-\u003eh2.h2n), \u0022h2n\u0022);\ndiff --git a/lib/roles/http/client/client-handshake.c b/lib/roles/http/client/client-handshake.c\nindex c5043bd..b2137df 100644\n--- a/lib/roles/http/client/client-handshake.c\n+++ b/lib/roles/http/client/client-handshake.c\n@@ -50,7 +50,7 @@ lws_client_connect_2(struct lws *wsi)\n \n \tlwsl_client(\u0022%s: %p\u005cn\u0022, __func__, wsi);\n \n-\tif (!wsi-\u003eah) {\n+\tif (!wsi-\u003ehttp.ah) {\n \t\tcce \u003d \u0022ah was NULL at cc2\u0022;\n \t\tlwsl_err(\u0022%s\u005cn\u0022, cce);\n \t\tgoto oom4;\n@@ -180,7 +180,7 @@ create_new_conn:\n \t *\n \t * Priority 1: connect to http proxy */\n \n-\tif (wsi-\u003evhost-\u003ehttp_proxy_port) {\n+\tif (wsi-\u003evhost-\u003ehttp.http_proxy_port) {\n \t\tplen \u003d sprintf((char *)pt-\u003eserv_buf,\n \t\t\t\u0022CONNECT %s:%u HTTP/1.0\u005cx0d\u005cx0a\u0022\n \t\t\t\u0022User-agent: libwebsockets\u005cx0d\u005cx0a\u0022,\n@@ -193,8 +193,8 @@ create_new_conn:\n \t\t\t\t\twsi-\u003evhost-\u003eproxy_basic_auth_token);\n \n \t\tplen +\u003d sprintf((char *)pt-\u003eserv_buf + plen, \u0022\u005cx0d\u005cx0a\u0022);\n-\t\tads \u003d wsi-\u003evhost-\u003ehttp_proxy_address;\n-\t\tport \u003d wsi-\u003evhost-\u003ehttp_proxy_port;\n+\t\tads \u003d wsi-\u003evhost-\u003ehttp.http_proxy_address;\n+\t\tport \u003d wsi-\u003evhost-\u003ehttp.http_proxy_port;\n \n #if defined(LWS_WITH_SOCKS5)\n \n@@ -447,7 +447,7 @@ create_new_conn:\n \t/* we are connected to server, or proxy */\n \n \t/* http proxy */\n-\tif (wsi-\u003evhost-\u003ehttp_proxy_port) {\n+\tif (wsi-\u003evhost-\u003ehttp.http_proxy_port) {\n \n \t\t/*\n \t\t * OK from now on we talk via the proxy, so connect to that\n@@ -456,9 +456,9 @@ create_new_conn:\n \t\t * leaving old string/frag there but unreferenced)\n \t\t */\n \t\tif (lws_hdr_simple_create(wsi, _WSI_TOKEN_CLIENT_PEER_ADDRESS,\n-\t\t\t\t\t wsi-\u003evhost-\u003ehttp_proxy_address))\n+\t\t\t\t\t wsi-\u003evhost-\u003ehttp.http_proxy_address))\n \t\t\tgoto failed;\n-\t\twsi-\u003ec_port \u003d wsi-\u003evhost-\u003ehttp_proxy_port;\n+\t\twsi-\u003ec_port \u003d wsi-\u003evhost-\u003ehttp.http_proxy_port;\n \n \t\tn \u003d send(wsi-\u003edesc.sockfd, (char *)pt-\u003eserv_buf, (int)plen,\n \t\t\t MSG_NOSIGNAL);\n@@ -665,7 +665,7 @@ lws_client_reset(struct lws **pwsi, int ssl, const char *address, int port,\n \twsi-\u003epending_timeout \u003d NO_PENDING_TIMEOUT;\n \twsi-\u003ec_port \u003d port;\n \twsi-\u003ehdr_parsing_completed \u003d 0;\n-\t_lws_header_table_reset(wsi-\u003eah);\n+\t_lws_header_table_reset(wsi-\u003ehttp.ah);\n \n \tif (lws_hdr_simple_create(wsi, _WSI_TOKEN_CLIENT_PEER_ADDRESS, address))\n \t\treturn NULL;\n@@ -887,8 +887,12 @@ lws_client_connect_via_info(struct lws_client_connect_info *i)\n \t\tgoto bail;\n \n \twsi-\u003econtext \u003d i-\u003econtext;\n+#if defined(LWS_ROLE_H1)\n \t/* assert the mode and union status (hdr) clearly */\n \tlws_role_transition(wsi, LWSIFR_CLIENT, LRS_UNCONNECTED, \u0026role_ops_h1);\n+#else\n+\tlws_role_transition(wsi, LWSIFR_CLIENT, LRS_UNCONNECTED, \u0026role_ops_raw);\n+#endif\n \twsi-\u003edesc.sockfd \u003d LWS_SOCK_INVALID;\n \n \t/* 1) fill up the wsi with stuff from the connect_info as far as it\ndiff --git a/lib/roles/http/client/client.c b/lib/roles/http/client/client.c\nindex a1841f5..130766a 100644\n--- a/lib/roles/http/client/client.c\n+++ b/lib/roles/http/client/client.c\n@@ -405,10 +405,10 @@ start_ws_handshake:\n \t\t\tlwsi_set_state(w, LRS_WAITING_SERVER_REPLY);\n \t\t\tw-\u003ehdr_parsing_completed \u003d 0;\n \n-\t\t\tw-\u003eah-\u003eparser_state \u003d WSI_TOKEN_NAME_PART;\n-\t\t\tw-\u003eah-\u003elextable_pos \u003d 0;\n+\t\t\tw-\u003ehttp.ah-\u003eparser_state \u003d WSI_TOKEN_NAME_PART;\n+\t\t\tw-\u003ehttp.ah-\u003elextable_pos \u003d 0;\n \t\t\t/* If we're (re)starting on headers, need other implied init */\n-\t\t\twsi-\u003eah-\u003eues \u003d URIES_IDLE;\n+\t\t\twsi-\u003ehttp.ah-\u003eues \u003d URIES_IDLE;\n \t\t}\n \n \t\tlws_set_timeout(wsi, PENDING_TIMEOUT_AWAITING_SERVER_RESPONSE,\n@@ -428,8 +428,8 @@ start_ws_handshake:\n \t\t}\n client_http_body_sent:\n \t\t/* prepare ourselves to do the parsing */\n-\t\twsi-\u003eah-\u003eparser_state \u003d WSI_TOKEN_NAME_PART;\n-\t\twsi-\u003eah-\u003elextable_pos \u003d 0;\n+\t\twsi-\u003ehttp.ah-\u003eparser_state \u003d WSI_TOKEN_NAME_PART;\n+\t\twsi-\u003ehttp.ah-\u003elextable_pos \u003d 0;\n \t\tlwsi_set_state(wsi, LRS_WAITING_SERVER_REPLY);\n \t\tlws_set_timeout(wsi, PENDING_TIMEOUT_AWAITING_SERVER_RESPONSE,\n \t\t\t\tcontext-\u003etimeout_secs);\n@@ -469,7 +469,7 @@ client_http_body_sent:\n \t\t * definitively ready from browser pov.\n \t\t */\n \t\tlen \u003d 1;\n-\t\twhile (wsi-\u003eah-\u003eparser_state !\u003d WSI_PARSING_COMPLETE \u0026\u0026\n+\t\twhile (wsi-\u003ehttp.ah-\u003eparser_state !\u003d WSI_PARSING_COMPLETE \u0026\u0026\n \t\t len \u003e 0) {\n \t\t\tint plen \u003d 1;\n \n@@ -496,7 +496,7 @@ client_http_body_sent:\n \t\t * libwebsocket timeout still active here too, so if parsing did\n \t\t * not complete just wait for next packet coming in this state\n \t\t */\n-\t\tif (wsi-\u003eah-\u003eparser_state !\u003d WSI_PARSING_COMPLETE)\n+\t\tif (wsi-\u003ehttp.ah-\u003eparser_state !\u003d WSI_PARSING_COMPLETE)\n \t\t\tbreak;\n \n \n@@ -599,14 +599,14 @@ lws_http_transaction_completed_client(struct lws *wsi)\n \t/* otherwise set ourselves up ready to go again */\n \tlwsi_set_state(wsi, LRS_WAITING_SERVER_REPLY);\n \n-\twsi-\u003eah-\u003eparser_state \u003d WSI_TOKEN_NAME_PART;\n-\twsi-\u003eah-\u003elextable_pos \u003d 0;\n+\twsi-\u003ehttp.ah-\u003eparser_state \u003d WSI_TOKEN_NAME_PART;\n+\twsi-\u003ehttp.ah-\u003elextable_pos \u003d 0;\n \n \tlws_set_timeout(wsi, PENDING_TIMEOUT_AWAITING_SERVER_RESPONSE,\n \t\t\twsi-\u003econtext-\u003etimeout_secs);\n \n \t/* If we're (re)starting on headers, need other implied init */\n-\twsi-\u003eah-\u003eues \u003d URIES_IDLE;\n+\twsi-\u003ehttp.ah-\u003eues \u003d URIES_IDLE;\n \n \tlwsl_info(\u0022%s: %p: new queued transaction as %p\u005cn\u0022, __func__, wsi, wsi_eff);\n \tlws_callback_on_writable(wsi);\n@@ -617,10 +617,10 @@ lws_http_transaction_completed_client(struct lws *wsi)\n LWS_VISIBLE LWS_EXTERN unsigned int\n lws_http_client_http_response(struct lws *wsi)\n {\n-\tif (!wsi-\u003eah)\n+\tif (!wsi-\u003ehttp.ah)\n \t\treturn 0;\n \n-\treturn wsi-\u003eah-\u003ehttp_response;\n+\treturn wsi-\u003ehttp.ah-\u003ehttp_response;\n }\n #if defined(LWS_PLAT_OPTEE)\n char *\n@@ -651,7 +651,7 @@ lws_client_interpret_server_handshake(struct lws *wsi)\n \n \tlws_client_stash_destroy(wsi);\n \n-\tah \u003d wsi-\u003eah;\n+\tah \u003d wsi-\u003ehttp.ah;\n \tif (!wsi-\u003edo_ws) {\n \t\t/* we are being an http client...\n \t\t */\n@@ -668,7 +668,7 @@ lws_client_interpret_server_handshake(struct lws *wsi)\n \t\t\t\t\t LRS_ESTABLISHED, \u0026role_ops_h1);\n \t\t}\n \n-\t\twsi-\u003eah \u003d ah;\n+\t\twsi-\u003ehttp.ah \u003d ah;\n \t\tah-\u003ehttp_response \u003d 0;\n \t}\n \ndiff --git a/lib/roles/http/header.c b/lib/roles/http/header.c\nindex 48beb74..a201c97 100644\n--- a/lib/roles/http/header.c\n+++ b/lib/roles/http/header.c\n@@ -277,15 +277,17 @@ lws_return_http_status(struct lws *wsi, unsigned int code,\n \n \t\treturn 1;\n \t}\n+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)\n \tif (!wsi-\u003ehandling_404 \u0026\u0026\n-\t wsi-\u003evhost-\u003eerror_document_404 \u0026\u0026\n+\t wsi-\u003evhost-\u003ehttp.error_document_404 \u0026\u0026\n \t code \u003d\u003d HTTP_STATUS_NOT_FOUND)\n \t\t/* we should do a redirect, and do the 404 there */\n \t\tif (lws_http_redirect(wsi, HTTP_STATUS_FOUND,\n-\t\t\t\t (uint8_t *)wsi-\u003evhost-\u003eerror_document_404,\n-\t\t\t\t (int)strlen(wsi-\u003evhost-\u003eerror_document_404),\n+\t\t\t\t (uint8_t *)wsi-\u003evhost-\u003ehttp.error_document_404,\n+\t\t\t\t (int)strlen(wsi-\u003evhost-\u003ehttp.error_document_404),\n \t\t\t\t \u0026p, end) \u003e 0)\n \t\t\treturn 0;\n+#endif\n \n \t/* if the redirect failed, just do a simple status */\n \tp \u003d start;\ndiff --git a/lib/roles/http/private.h b/lib/roles/http/private.h\nindex 07c6b62..e8519bd 100644\n--- a/lib/roles/http/private.h\n+++ b/lib/roles/http/private.h\n@@ -158,12 +158,38 @@ LWS_EXTERN int\n lws_rewrite_parse(struct lws_rewrite *r, const unsigned char *in, int in_len);\n #endif\n \n+struct lws_pt_role_http {\n+\tstruct allocated_headers *ah_list;\n+\tstruct lws *ah_wait_list;\n+#ifdef LWS_WITH_CGI\n+\tstruct lws_cgi *cgi_list;\n+#endif\n+\tint ah_wait_list_length;\n+\tuint32_t ah_pool_length;\n+\n+\tint ah_count_in_use;\n+};\n+\n+struct lws_peer_role_http {\n+\tuint32_t count_ah;\n+\tuint32_t total_ah;\n+};\n+\n+struct lws_vhost_role_http {\n+\tchar http_proxy_address[128];\n+\tconst struct lws_http_mount *mount_list;\n+\tconst char *error_document_404;\n+\tunsigned int http_proxy_port;\n+};\n+\n struct _lws_http_mode_related {\n \tstruct lws *new_wsi_list;\n \n #if defined(LWS_WITH_HTTP_PROXY)\n \tstruct lws_rewrite *rw;\n #endif\n+\tstruct allocated_headers *ah;\n+\tstruct lws *ah_wait_list;\n \n \tlws_filepos_t filepos;\n \tlws_filepos_t filelen;\ndiff --git a/lib/roles/http/server/parsers.c b/lib/roles/http/server/parsers.c\nindex 67c8dd6..c9ee323 100644\n--- a/lib/roles/http/server/parsers.c\n+++ b/lib/roles/http/server/parsers.c\n@@ -41,13 +41,13 @@ _lws_create_ah(struct lws_context_per_thread *pt, ah_data_idx_t data_size)\n \n \t\treturn NULL;\n \t}\n-\tah-\u003enext \u003d pt-\u003eah_list;\n-\tpt-\u003eah_list \u003d ah;\n+\tah-\u003enext \u003d pt-\u003ehttp.ah_list;\n+\tpt-\u003ehttp.ah_list \u003d ah;\n \tah-\u003edata_length \u003d data_size;\n-\tpt-\u003eah_pool_length++;\n+\tpt-\u003ehttp.ah_pool_length++;\n \n \tlwsl_info(\u0022%s: created ah %p (size %d): pool length %d\u005cn\u0022, __func__,\n-\t\t ah, (int)data_size, pt-\u003eah_pool_length);\n+\t\t ah, (int)data_size, pt-\u003ehttp.ah_pool_length);\n \n \treturn ah;\n }\n@@ -55,12 +55,12 @@ _lws_create_ah(struct lws_context_per_thread *pt, ah_data_idx_t data_size)\n int\n _lws_destroy_ah(struct lws_context_per_thread *pt, struct allocated_headers *ah)\n {\n-\tlws_start_foreach_llp(struct allocated_headers **, a, pt-\u003eah_list) {\n+\tlws_start_foreach_llp(struct allocated_headers **, a, pt-\u003ehttp.ah_list) {\n \t\tif ((*a) \u003d\u003d ah) {\n \t\t\t*a \u003d ah-\u003enext;\n-\t\t\tpt-\u003eah_pool_length--;\n+\t\t\tpt-\u003ehttp.ah_pool_length--;\n \t\t\tlwsl_info(\u0022%s: freed ah %p : pool length %d\u005cn\u0022,\n-\t\t\t\t __func__, ah, pt-\u003eah_pool_length);\n+\t\t\t\t __func__, ah, pt-\u003ehttp.ah_pool_length);\n \t\t\tif (ah-\u003edata)\n \t\t\t\tlws_free(ah-\u003edata);\n \t\t\tlws_free(ah);\n@@ -88,7 +88,7 @@ _lws_header_table_reset(struct allocated_headers *ah)\n void\n __lws_header_table_reset(struct lws *wsi, int autoservice)\n {\n-\tstruct allocated_headers *ah \u003d wsi-\u003eah;\n+\tstruct allocated_headers *ah \u003d wsi-\u003ehttp.ah;\n \tstruct lws_context_per_thread *pt;\n \tstruct lws_pollfd *pfd;\n \n@@ -144,18 +144,18 @@ _lws_header_ensure_we_are_on_waiting_list(struct lws *wsi)\n {\n \tstruct lws_context_per_thread *pt \u003d \u0026wsi-\u003econtext-\u003ept[(int)wsi-\u003etsi];\n \tstruct lws_pollargs pa;\n-\tstruct lws **pwsi \u003d \u0026pt-\u003eah_wait_list;\n+\tstruct lws **pwsi \u003d \u0026pt-\u003ehttp.ah_wait_list;\n \n \twhile (*pwsi) {\n \t\tif (*pwsi \u003d\u003d wsi)\n \t\t\treturn;\n-\t\tpwsi \u003d \u0026(*pwsi)-\u003eah_wait_list;\n+\t\tpwsi \u003d \u0026(*pwsi)-\u003ehttp.ah_wait_list;\n \t}\n \n \tlwsl_info(\u0022%s: wsi: %p\u005cn\u0022, __func__, wsi);\n-\twsi-\u003eah_wait_list \u003d pt-\u003eah_wait_list;\n-\tpt-\u003eah_wait_list \u003d wsi;\n-\tpt-\u003eah_wait_list_length++;\n+\twsi-\u003ehttp.ah_wait_list \u003d pt-\u003ehttp.ah_wait_list;\n+\tpt-\u003ehttp.ah_wait_list \u003d wsi;\n+\tpt-\u003ehttp.ah_wait_list_length++;\n \n \t/* we cannot accept input then */\n \n@@ -166,20 +166,20 @@ static int\n __lws_remove_from_ah_waiting_list(struct lws *wsi)\n {\n struct lws_context_per_thread *pt \u003d \u0026wsi-\u003econtext-\u003ept[(int)wsi-\u003etsi];\n-\tstruct lws **pwsi \u003d\u0026pt-\u003eah_wait_list;\n+\tstruct lws **pwsi \u003d\u0026pt-\u003ehttp.ah_wait_list;\n \n \twhile (*pwsi) {\n \t\tif (*pwsi \u003d\u003d wsi) {\n \t\t\tlwsl_info(\u0022%s: wsi %p\u005cn\u0022, __func__, wsi);\n \t\t\t/* point prev guy to our next */\n-\t\t\t*pwsi \u003d wsi-\u003eah_wait_list;\n+\t\t\t*pwsi \u003d wsi-\u003ehttp.ah_wait_list;\n \t\t\t/* we shouldn't point anywhere now */\n-\t\t\twsi-\u003eah_wait_list \u003d NULL;\n-\t\t\tpt-\u003eah_wait_list_length--;\n+\t\t\twsi-\u003ehttp.ah_wait_list \u003d NULL;\n+\t\t\tpt-\u003ehttp.ah_wait_list_length--;\n \n \t\t\treturn 1;\n \t\t}\n-\t\tpwsi \u003d \u0026(*pwsi)-\u003eah_wait_list;\n+\t\tpwsi \u003d \u0026(*pwsi)-\u003ehttp.ah_wait_list;\n \t}\n \n \treturn 0;\n@@ -194,18 +194,18 @@ lws_header_table_attach(struct lws *wsi, int autoservice)\n \tint n;\n \n \tlwsl_info(\u0022%s: wsi %p: ah %p (tsi %d, count \u003d %d) in\u005cn\u0022, __func__,\n-\t\t (void *)wsi, (void *)wsi-\u003eah, wsi-\u003etsi,\n-\t\t pt-\u003eah_count_in_use);\n+\t\t (void *)wsi, (void *)wsi-\u003ehttp.ah, wsi-\u003etsi,\n+\t\t pt-\u003ehttp.ah_count_in_use);\n \n \tlws_pt_lock(pt, __func__);\n \n \t/* if we are already bound to one, just clear it down */\n-\tif (wsi-\u003eah) {\n+\tif (wsi-\u003ehttp.ah) {\n \t\tlwsl_info(\u0022%s: cleardown\u005cn\u0022, __func__);\n \t\tgoto reset;\n \t}\n \n-\tn \u003d pt-\u003eah_count_in_use \u003d\u003d context-\u003emax_http_header_pool;\n+\tn \u003d pt-\u003ehttp.ah_count_in_use \u003d\u003d context-\u003emax_http_header_pool;\n #if defined(LWS_WITH_PEER_LIMITS)\n \tif (!n) {\n \t\tn \u003d lws_peer_confirm_ah_attach_ok(context, wsi-\u003epeer);\n@@ -229,26 +229,28 @@ lws_header_table_attach(struct lws *wsi, int autoservice)\n \n \t__lws_remove_from_ah_waiting_list(wsi);\n \n-\twsi-\u003eah \u003d _lws_create_ah(pt, context-\u003emax_http_header_data);\n-\tif (!wsi-\u003eah) { /* we could not create an ah */\n+\twsi-\u003ehttp.ah \u003d _lws_create_ah(pt, context-\u003emax_http_header_data);\n+\tif (!wsi-\u003ehttp.ah) { /* we could not create an ah */\n \t\t_lws_header_ensure_we_are_on_waiting_list(wsi);\n \n \t\tgoto bail;\n \t}\n \n-\twsi-\u003eah-\u003ein_use \u003d 1;\n-\twsi-\u003eah-\u003ewsi \u003d wsi; /* mark our owner */\n-\tpt-\u003eah_count_in_use++;\n+\twsi-\u003ehttp.ah-\u003ein_use \u003d 1;\n+\twsi-\u003ehttp.ah-\u003ewsi \u003d wsi; /* mark our owner */\n+\tpt-\u003ehttp.ah_count_in_use++;\n \n-#if defined(LWS_WITH_PEER_LIMITS)\n+#if defined(LWS_WITH_PEER_LIMITS) \u0026\u0026 (defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2))\n+\tlws_context_lock(context); /* \u003c\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d */\n \tif (wsi-\u003epeer)\n-\t\twsi-\u003epeer-\u003ecount_ah++;\n+\t\twsi-\u003epeer-\u003ehttp.count_ah++;\n+\tlws_context_unlock(context); /* \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003e */\n #endif\n \n \t_lws_change_pollfd(wsi, 0, LWS_POLLIN, \u0026pa);\n \n \tlwsl_info(\u0022%s: did attach wsi %p: ah %p: count %d (on exit)\u005cn\u0022, __func__,\n-\t\t (void *)wsi, (void *)wsi-\u003eah, pt-\u003eah_count_in_use);\n+\t\t (void *)wsi, (void *)wsi-\u003ehttp.ah, pt-\u003ehttp.ah_count_in_use);\n \n reset:\n \t__lws_header_table_reset(wsi, autoservice);\n@@ -275,7 +277,7 @@ bail:\n int __lws_header_table_detach(struct lws *wsi, int autoservice)\n {\n \tstruct lws_context *context \u003d wsi-\u003econtext;\n-\tstruct allocated_headers *ah \u003d wsi-\u003eah;\n+\tstruct allocated_headers *ah \u003d wsi-\u003ehttp.ah;\n \tstruct lws_context_per_thread *pt \u003d \u0026context-\u003ept[(int)wsi-\u003etsi];\n \tstruct lws_pollargs pa;\n \tstruct lws **pwsi, **pwsi_eligible;\n@@ -288,7 +290,7 @@ int __lws_header_table_detach(struct lws *wsi, int autoservice)\n \n \tlwsl_info(\u0022%s: wsi %p: ah %p (tsi\u003d%d, count \u003d %d)\u005cn\u0022, __func__,\n \t\t (void *)wsi, (void *)ah, wsi-\u003etsi,\n-\t\t pt-\u003eah_count_in_use);\n+\t\t pt-\u003ehttp.ah_count_in_use);\n \n \t/* we did have an ah attached */\n \ttime(\u0026now);\n@@ -305,10 +307,10 @@ int __lws_header_table_detach(struct lws *wsi, int autoservice)\n \tah-\u003eassigned \u003d 0;\n \n \t/* if we think we're detaching one, there should be one in use */\n-\tassert(pt-\u003eah_count_in_use \u003e 0);\n+\tassert(pt-\u003ehttp.ah_count_in_use \u003e 0);\n \t/* and this specific one should have been in use */\n \tassert(ah-\u003ein_use);\n-\tmemset(\u0026wsi-\u003eah, 0, sizeof(wsi-\u003eah));\n+\tmemset(\u0026wsi-\u003ehttp.ah, 0, sizeof(wsi-\u003ehttp.ah));\n \n #if defined(LWS_WITH_PEER_LIMITS)\n \tif (ah-\u003ewsi)\n@@ -316,7 +318,7 @@ int __lws_header_table_detach(struct lws *wsi, int autoservice)\n #endif\n \tah-\u003ewsi \u003d NULL; /* no owner */\n \n-\tpwsi \u003d \u0026pt-\u003eah_wait_list;\n+\tpwsi \u003d \u0026pt-\u003ehttp.ah_wait_list;\n \n \t/* oh there is nobody on the waiting list... leave the ah unattached */\n \tif (!*pwsi)\n@@ -341,11 +343,11 @@ int __lws_header_table_detach(struct lws *wsi, int autoservice)\n \t\t}\n #if defined(LWS_WITH_PEER_LIMITS)\n \t\telse\n-\t\t\tif (!(*pwsi)-\u003eah_wait_list)\n+\t\t\tif (!(*pwsi)-\u003ehttp.ah_wait_list)\n \t\t\t\tlws_stats_atomic_bump(context, pt,\n \t\t\t\t\tLWSSTATS_C_PEER_LIMIT_AH_DENIED, 1);\n #endif\n-\t\tpwsi \u003d \u0026(*pwsi)-\u003eah_wait_list;\n+\t\tpwsi \u003d \u0026(*pwsi)-\u003ehttp.ah_wait_list;\n \t}\n \n \tif (!wsi) /* everybody waiting already has too many ah... */\n@@ -353,14 +355,14 @@ int __lws_header_table_detach(struct lws *wsi, int autoservice)\n \n \tlwsl_info(\u0022%s: last eligible wsi in wait list %p\u005cn\u0022, __func__, wsi);\n \n-\twsi-\u003eah \u003d ah;\n+\twsi-\u003ehttp.ah \u003d ah;\n \tah-\u003ewsi \u003d wsi; /* new owner */\n \n \t__lws_header_table_reset(wsi, autoservice);\n-#if defined(LWS_WITH_PEER_LIMITS)\n+#if defined(LWS_WITH_PEER_LIMITS) \u0026\u0026 (defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2))\n \tlws_context_lock(context); /* \u003c\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d */\n \tif (wsi-\u003epeer)\n-\t\twsi-\u003epeer-\u003ecount_ah++;\n+\t\twsi-\u003epeer-\u003ehttp.count_ah++;\n \tlws_context_unlock(context); /* \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003e */\n #endif\n \n@@ -375,10 +377,10 @@ int __lws_header_table_detach(struct lws *wsi, int autoservice)\n \t}\n \n \t/* point prev guy to next guy in list instead */\n-\t*pwsi_eligible \u003d wsi-\u003eah_wait_list;\n+\t*pwsi_eligible \u003d wsi-\u003ehttp.ah_wait_list;\n \t/* the guy who got one is out of the list */\n-\twsi-\u003eah_wait_list \u003d NULL;\n-\tpt-\u003eah_wait_list_length--;\n+\twsi-\u003ehttp.ah_wait_list \u003d NULL;\n+\tpt-\u003ehttp.ah_wait_list_length--;\n \n #ifndef LWS_NO_CLIENT\n \tif (lwsi_role_client(wsi) \u0026\u0026 lwsi_state(wsi) \u003d\u003d LRS_UNCONNECTED) {\n@@ -395,17 +397,17 @@ int __lws_header_table_detach(struct lws *wsi, int autoservice)\n \t}\n #endif\n \n-\tassert(!!pt-\u003eah_wait_list_length \u003d\u003d !!(lws_intptr_t)pt-\u003eah_wait_list);\n+\tassert(!!pt-\u003ehttp.ah_wait_list_length \u003d\u003d !!(lws_intptr_t)pt-\u003ehttp.ah_wait_list);\n bail:\n \tlwsl_info(\u0022%s: wsi %p: ah %p (tsi\u003d%d, count \u003d %d)\u005cn\u0022, __func__,\n-\t\t (void *)wsi, (void *)ah, pt-\u003etid, pt-\u003eah_count_in_use);\n+\t\t (void *)wsi, (void *)ah, pt-\u003etid, pt-\u003ehttp.ah_count_in_use);\n \n \treturn 0;\n \n nobody_usable_waiting:\n \tlwsl_info(\u0022%s: nobody usable waiting\u005cn\u0022, __func__);\n \t_lws_destroy_ah(pt, ah);\n-\tpt-\u003eah_count_in_use--;\n+\tpt-\u003ehttp.ah_count_in_use--;\n \n \tgoto bail;\n }\n@@ -428,16 +430,16 @@ lws_hdr_fragment_length(struct lws *wsi, enum lws_token_indexes h, int frag_idx)\n {\n \tint n;\n \n-\tif (!wsi-\u003eah)\n+\tif (!wsi-\u003ehttp.ah)\n \t\treturn 0;\n \n-\tn \u003d wsi-\u003eah-\u003efrag_index[h];\n+\tn \u003d wsi-\u003ehttp.ah-\u003efrag_index[h];\n \tif (!n)\n \t\treturn 0;\n \tdo {\n \t\tif (!frag_idx)\n-\t\t\treturn wsi-\u003eah-\u003efrags[n].len;\n-\t\tn \u003d wsi-\u003eah-\u003efrags[n].nfrag;\n+\t\t\treturn wsi-\u003ehttp.ah-\u003efrags[n].len;\n+\t\tn \u003d wsi-\u003ehttp.ah-\u003efrags[n].nfrag;\n \t} while (frag_idx-- \u0026\u0026 n);\n \n \treturn 0;\n@@ -448,15 +450,15 @@ LWS_VISIBLE int lws_hdr_total_length(struct lws *wsi, enum lws_token_indexes h)\n \tint n;\n \tint len \u003d 0;\n \n-\tif (!wsi-\u003eah)\n+\tif (!wsi-\u003ehttp.ah)\n \t\treturn 0;\n \n-\tn \u003d wsi-\u003eah-\u003efrag_index[h];\n+\tn \u003d wsi-\u003ehttp.ah-\u003efrag_index[h];\n \tif (!n)\n \t\treturn 0;\n \tdo {\n-\t\tlen +\u003d wsi-\u003eah-\u003efrags[n].len;\n-\t\tn \u003d wsi-\u003eah-\u003efrags[n].nfrag;\n+\t\tlen +\u003d wsi-\u003ehttp.ah-\u003efrags[n].len;\n+\t\tn \u003d wsi-\u003ehttp.ah-\u003efrags[n].nfrag;\n \t} while (n);\n \n \treturn len;\n@@ -468,29 +470,29 @@ LWS_VISIBLE int lws_hdr_copy_fragment(struct lws *wsi, char *dst, int len,\n \tint n \u003d 0;\n \tint f;\n \n-\tif (!wsi-\u003eah)\n+\tif (!wsi-\u003ehttp.ah)\n \t\treturn -1;\n \n-\tf \u003d wsi-\u003eah-\u003efrag_index[h];\n+\tf \u003d wsi-\u003ehttp.ah-\u003efrag_index[h];\n \n \tif (!f)\n \t\treturn -1;\n \n \twhile (n \u003c frag_idx) {\n-\t\tf \u003d wsi-\u003eah-\u003efrags[f].nfrag;\n+\t\tf \u003d wsi-\u003ehttp.ah-\u003efrags[f].nfrag;\n \t\tif (!f)\n \t\t\treturn -1;\n \t\tn++;\n \t}\n \n-\tif (wsi-\u003eah-\u003efrags[f].len \u003e\u003d len)\n+\tif (wsi-\u003ehttp.ah-\u003efrags[f].len \u003e\u003d len)\n \t\treturn -1;\n \n-\tmemcpy(dst, wsi-\u003eah-\u003edata + wsi-\u003eah-\u003efrags[f].offset,\n-\t wsi-\u003eah-\u003efrags[f].len);\n-\tdst[wsi-\u003eah-\u003efrags[f].len] \u003d '\u005c0';\n+\tmemcpy(dst, wsi-\u003ehttp.ah-\u003edata + wsi-\u003ehttp.ah-\u003efrags[f].offset,\n+\t wsi-\u003ehttp.ah-\u003efrags[f].len);\n+\tdst[wsi-\u003ehttp.ah-\u003efrags[f].len] \u003d '\u005c0';\n \n-\treturn wsi-\u003eah-\u003efrags[f].len;\n+\treturn wsi-\u003ehttp.ah-\u003efrags[f].len;\n }\n \n LWS_VISIBLE int lws_hdr_copy(struct lws *wsi, char *dst, int len,\n@@ -502,21 +504,21 @@ LWS_VISIBLE int lws_hdr_copy(struct lws *wsi, char *dst, int len,\n \tif (toklen \u003e\u003d len)\n \t\treturn -1;\n \n-\tif (!wsi-\u003eah)\n+\tif (!wsi-\u003ehttp.ah)\n \t\treturn -1;\n \n-\tn \u003d wsi-\u003eah-\u003efrag_index[h];\n+\tn \u003d wsi-\u003ehttp.ah-\u003efrag_index[h];\n \tif (!n)\n \t\treturn 0;\n \n \tdo {\n-\t\tif (wsi-\u003eah-\u003efrags[n].len \u003e\u003d len)\n+\t\tif (wsi-\u003ehttp.ah-\u003efrags[n].len \u003e\u003d len)\n \t\t\treturn -1;\n-\t\tstrncpy(dst, \u0026wsi-\u003eah-\u003edata[wsi-\u003eah-\u003efrags[n].offset],\n-\t\t wsi-\u003eah-\u003efrags[n].len);\n-\t\tdst +\u003d wsi-\u003eah-\u003efrags[n].len;\n-\t\tlen -\u003d wsi-\u003eah-\u003efrags[n].len;\n-\t\tn \u003d wsi-\u003eah-\u003efrags[n].nfrag;\n+\t\tstrncpy(dst, \u0026wsi-\u003ehttp.ah-\u003edata[wsi-\u003ehttp.ah-\u003efrags[n].offset],\n+\t\t wsi-\u003ehttp.ah-\u003efrags[n].len);\n+\t\tdst +\u003d wsi-\u003ehttp.ah-\u003efrags[n].len;\n+\t\tlen -\u003d wsi-\u003ehttp.ah-\u003efrags[n].len;\n+\t\tn \u003d wsi-\u003ehttp.ah-\u003efrags[n].nfrag;\n \t} while (n);\n \t*dst \u003d '\u005c0';\n \n@@ -527,21 +529,21 @@ char *lws_hdr_simple_ptr(struct lws *wsi, enum lws_token_indexes h)\n {\n \tint n;\n \n-\tn \u003d wsi-\u003eah-\u003efrag_index[h];\n+\tn \u003d wsi-\u003ehttp.ah-\u003efrag_index[h];\n \tif (!n)\n \t\treturn NULL;\n \n-\treturn wsi-\u003eah-\u003edata + wsi-\u003eah-\u003efrags[n].offset;\n+\treturn wsi-\u003ehttp.ah-\u003edata + wsi-\u003ehttp.ah-\u003efrags[n].offset;\n }\n \n static int LWS_WARN_UNUSED_RESULT\n lws_pos_in_bounds(struct lws *wsi)\n {\n-\tif (wsi-\u003eah-\u003epos \u003c\n+\tif (wsi-\u003ehttp.ah-\u003epos \u003c\n \t (unsigned int)wsi-\u003econtext-\u003emax_http_header_data)\n \t\treturn 0;\n \n-\tif ((int)wsi-\u003eah-\u003epos \u003d\u003d wsi-\u003econtext-\u003emax_http_header_data) {\n+\tif ((int)wsi-\u003ehttp.ah-\u003epos \u003d\u003d wsi-\u003econtext-\u003emax_http_header_data) {\n \t\tlwsl_err(\u0022Ran out of header data space\u005cn\u0022);\n \t\treturn 1;\n \t}\n@@ -550,7 +552,7 @@ lws_pos_in_bounds(struct lws *wsi)\n \t * with these tests everywhere, it should never be able to exceed\n \t * the limit, only meet it\n \t */\n-\tlwsl_err(\u0022%s: pos %d, limit %d\u005cn\u0022, __func__, wsi-\u003eah-\u003epos,\n+\tlwsl_err(\u0022%s: pos %d, limit %d\u005cn\u0022, __func__, wsi-\u003ehttp.ah-\u003epos,\n \t\t wsi-\u003econtext-\u003emax_http_header_data);\n \tassert(0);\n \n@@ -560,25 +562,25 @@ lws_pos_in_bounds(struct lws *wsi)\n int LWS_WARN_UNUSED_RESULT\n lws_hdr_simple_create(struct lws *wsi, enum lws_token_indexes h, const char *s)\n {\n-\twsi-\u003eah-\u003enfrag++;\n-\tif (wsi-\u003eah-\u003enfrag \u003d\u003d ARRAY_SIZE(wsi-\u003eah-\u003efrags)) {\n+\twsi-\u003ehttp.ah-\u003enfrag++;\n+\tif (wsi-\u003ehttp.ah-\u003enfrag \u003d\u003d ARRAY_SIZE(wsi-\u003ehttp.ah-\u003efrags)) {\n \t\tlwsl_warn(\u0022More hdr frags than we can deal with, dropping\u005cn\u0022);\n \t\treturn -1;\n \t}\n \n-\twsi-\u003eah-\u003efrag_index[h] \u003d wsi-\u003eah-\u003enfrag;\n+\twsi-\u003ehttp.ah-\u003efrag_index[h] \u003d wsi-\u003ehttp.ah-\u003enfrag;\n \n-\twsi-\u003eah-\u003efrags[wsi-\u003eah-\u003enfrag].offset \u003d wsi-\u003eah-\u003epos;\n-\twsi-\u003eah-\u003efrags[wsi-\u003eah-\u003enfrag].len \u003d 0;\n-\twsi-\u003eah-\u003efrags[wsi-\u003eah-\u003enfrag].nfrag \u003d 0;\n+\twsi-\u003ehttp.ah-\u003efrags[wsi-\u003ehttp.ah-\u003enfrag].offset \u003d wsi-\u003ehttp.ah-\u003epos;\n+\twsi-\u003ehttp.ah-\u003efrags[wsi-\u003ehttp.ah-\u003enfrag].len \u003d 0;\n+\twsi-\u003ehttp.ah-\u003efrags[wsi-\u003ehttp.ah-\u003enfrag].nfrag \u003d 0;\n \n \tdo {\n \t\tif (lws_pos_in_bounds(wsi))\n \t\t\treturn -1;\n \n-\t\twsi-\u003eah-\u003edata[wsi-\u003eah-\u003epos++] \u003d *s;\n+\t\twsi-\u003ehttp.ah-\u003edata[wsi-\u003ehttp.ah-\u003epos++] \u003d *s;\n \t\tif (*s)\n-\t\t\twsi-\u003eah-\u003efrags[wsi-\u003eah-\u003enfrag].len++;\n+\t\t\twsi-\u003ehttp.ah-\u003efrags[wsi-\u003ehttp.ah-\u003enfrag].len++;\n \t} while (*s++);\n \n \treturn 0;\n@@ -606,27 +608,27 @@ issue_char(struct lws *wsi, unsigned char c)\n \tif (lws_pos_in_bounds(wsi))\n \t\treturn -1;\n \n-\tfrag_len \u003d wsi-\u003eah-\u003efrags[wsi-\u003eah-\u003enfrag].len;\n+\tfrag_len \u003d wsi-\u003ehttp.ah-\u003efrags[wsi-\u003ehttp.ah-\u003enfrag].len;\n \t/*\n \t * If we haven't hit the token limit, just copy the character into\n \t * the header\n \t */\n-\tif (frag_len \u003c wsi-\u003eah-\u003ecurrent_token_limit) {\n-\t\twsi-\u003eah-\u003edata[wsi-\u003eah-\u003epos++] \u003d c;\n+\tif (frag_len \u003c wsi-\u003ehttp.ah-\u003ecurrent_token_limit) {\n+\t\twsi-\u003ehttp.ah-\u003edata[wsi-\u003ehttp.ah-\u003epos++] \u003d c;\n \t\tif (c)\n-\t\t\twsi-\u003eah-\u003efrags[wsi-\u003eah-\u003enfrag].len++;\n+\t\t\twsi-\u003ehttp.ah-\u003efrags[wsi-\u003ehttp.ah-\u003enfrag].len++;\n \t\treturn 0;\n \t}\n \n \t/* Insert a null character when we *hit* the limit: */\n-\tif (frag_len \u003d\u003d wsi-\u003eah-\u003ecurrent_token_limit) {\n+\tif (frag_len \u003d\u003d wsi-\u003ehttp.ah-\u003ecurrent_token_limit) {\n \t\tif (lws_pos_in_bounds(wsi))\n \t\t\treturn -1;\n \n-\t\twsi-\u003eah-\u003edata[wsi-\u003eah-\u003epos++] \u003d '\u005c0';\n+\t\twsi-\u003ehttp.ah-\u003edata[wsi-\u003ehttp.ah-\u003epos++] \u003d '\u005c0';\n \t\tlwsl_warn(\u0022header %i exceeds limit %d\u005cn\u0022,\n-\t\t\t wsi-\u003eah-\u003eparser_state,\n-\t\t\t wsi-\u003eah-\u003ecurrent_token_limit);\n+\t\t\t wsi-\u003ehttp.ah-\u003eparser_state,\n+\t\t\t wsi-\u003ehttp.ah-\u003ecurrent_token_limit);\n \t}\n \n \treturn 1;\n@@ -635,7 +637,7 @@ issue_char(struct lws *wsi, unsigned char c)\n int\n lws_parse_urldecode(struct lws *wsi, uint8_t *_c)\n {\n-\tstruct allocated_headers *ah \u003d wsi-\u003eah;\n+\tstruct allocated_headers *ah \u003d wsi-\u003ehttp.ah;\n \tunsigned int enc \u003d 0;\n \tuint8_t c \u003d *_c;\n \n@@ -841,13 +843,13 @@ static const unsigned char methods[] \u003d {\n int LWS_WARN_UNUSED_RESULT\n lws_parse(struct lws *wsi, unsigned char *buf, int *len)\n {\n-\tstruct allocated_headers *ah \u003d wsi-\u003eah;\n+\tstruct allocated_headers *ah \u003d wsi-\u003ehttp.ah;\n \tstruct lws_context *context \u003d wsi-\u003econtext;\n \tunsigned int n, m;\n \tunsigned char c;\n \tint r, pos;\n \n-\tassert(wsi-\u003eah);\n+\tassert(wsi-\u003ehttp.ah);\n \n \tdo {\n \t\t(*len)--;\ndiff --git a/lib/roles/http/server/server.c b/lib/roles/http/server/server.c\nindex fac864e..5c819cd 100644\n--- a/lib/roles/http/server/server.c\n+++ b/lib/roles/http/server/server.c\n@@ -460,9 +460,11 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin,\n \tif (!wsi-\u003evhost)\n \t\treturn -1;\n \n-\tif (wsi-\u003evhost-\u003eerror_document_404 \u0026\u0026\n-\t !strcmp(uri, wsi-\u003evhost-\u003eerror_document_404))\n+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)\n+\tif (wsi-\u003evhost-\u003ehttp.error_document_404 \u0026\u0026\n+\t !strcmp(uri, wsi-\u003evhost-\u003ehttp.error_document_404))\n \t\twsi-\u003ehandling_404 \u003d 1;\n+#endif\n \n \tlws_snprintf(path, sizeof(path) - 1, \u0022%s/%s\u0022, origin, uri);\n \n@@ -546,7 +548,7 @@ lws_http_serve(struct lws *wsi, char *uri, const char *origin,\n \tif (lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_IF_RANGE))\n \t\tif (strcmp(sym, lws_hdr_simple_ptr(wsi, WSI_TOKEN_HTTP_IF_RANGE)))\n \t\t\t/* differs - defeat Range: */\n-\t\t\twsi-\u003eah-\u003efrag_index[WSI_TOKEN_HTTP_RANGE] \u003d 0;\n+\t\t\twsi-\u003ehttp.ah-\u003efrag_index[WSI_TOKEN_HTTP_RANGE] \u003d 0;\n \n \tif (lws_hdr_total_length(wsi, WSI_TOKEN_HTTP_IF_NONE_MATCH)) {\n \t\t/*\n@@ -653,13 +655,14 @@ bail:\n \treturn -1;\n }\n \n+#if defined(LWS_ROLE_H1) || defined(LWS_ROLE_H2)\n const struct lws_http_mount *\n lws_find_mount(struct lws *wsi, const char *uri_ptr, int uri_len)\n {\n \tconst struct lws_http_mount *hm, *hit \u003d NULL;\n \tint best \u003d 0;\n \n-\thm \u003d wsi-\u003evhost-\u003emount_list;\n+\thm \u003d wsi-\u003evhost-\u003ehttp.mount_list;\n \twhile (hm) {\n \t\tif (uri_len \u003e\u003d hm-\u003emountpoint_len \u0026\u0026\n \t\t !strncmp(uri_ptr, hm-\u003emountpoint, hm-\u003emountpoint_len) \u0026\u0026\n@@ -684,6 +687,7 @@ lws_find_mount(struct lws *wsi, const char *uri_ptr, int uri_len)\n \n \treturn hit;\n }\n+#endif\n \n #if !defined(LWS_WITH_ESP32)\n static int\n@@ -1383,7 +1387,7 @@ lws_handshake_server(struct lws *wsi, unsigned char **buf, size_t len)\n \t\tassert(0);\n \t}\n \n-\tif (!wsi-\u003eah) {\n+\tif (!wsi-\u003ehttp.ah) {\n \t\tlwsl_err(\u0022%s: assert: NULL ah\u005cn\u0022, __func__);\n \t\tassert(0);\n \t}\n@@ -1435,7 +1439,7 @@ raw_transition:\n \t\t\tgoto bail_nuke_ah;\n \t\t}\n \n-\t\tif (wsi-\u003eah-\u003eparser_state !\u003d WSI_PARSING_COMPLETE)\n+\t\tif (wsi-\u003ehttp.ah-\u003eparser_state !\u003d WSI_PARSING_COMPLETE)\n \t\t\tcontinue;\n \n \t\tlwsl_parser(\u0022%s: lws_parse sees parsing complete\u005cn\u0022, __func__);\n@@ -1550,7 +1554,7 @@ raw_transition:\n \t\twsi-\u003ehttp.fop_fd \u003d NULL;\n \n \t\tlwsl_debug(\u0022%s: wsi %p: ah %p\u005cn\u0022, __func__, (void *)wsi,\n-\t\t\t (void *)wsi-\u003eah);\n+\t\t\t (void *)wsi-\u003ehttp.ah);\n \n \t\tn \u003d lws_http_action(wsi);\n \n@@ -1764,7 +1768,7 @@ lws_http_transaction_completed(struct lws *wsi)\n \t * that is already at least the start of another header set, simply\n \t * reset the existing header table and keep it.\n \t */\n-\tif (wsi-\u003eah) {\n+\tif (wsi-\u003ehttp.ah) {\n \t\t// lws_buflist_describe(\u0026wsi-\u003ebuflist, wsi);\n \t\tif (!lws_buflist_next_segment_len(\u0026wsi-\u003ebuflist, NULL)) {\n \t\t\tlwsl_debug(\u0022%s: nothing in buflist so detaching ah\u005cn\u0022, __func__);\n@@ -1798,8 +1802,8 @@ lws_http_transaction_completed(struct lws *wsi)\n \t\t\t\t\twsi-\u003evhost-\u003ekeepalive_timeout);\n \t\t}\n \t\t/* If we're (re)starting on headers, need other implied init */\n-\t\tif (wsi-\u003eah)\n-\t\t\twsi-\u003eah-\u003eues \u003d URIES_IDLE;\n+\t\tif (wsi-\u003ehttp.ah)\n+\t\t\twsi-\u003ehttp.ah-\u003eues \u003d URIES_IDLE;\n \n \t\tlwsi_set_state(wsi, LRS_ESTABLISHED);\n \t} else\n@@ -2074,7 +2078,7 @@ adopt_socket_readbuf(struct lws *wsi, const char *readbuf, size_t len)\n \t * readbuf data to wsi or ah yet, and we will do it next if we get\n \t * the ah.\n \t */\n-\tif (wsi-\u003eah || !lws_header_table_attach(wsi, 0)) {\n+\tif (wsi-\u003ehttp.ah || !lws_header_table_attach(wsi, 0)) {\n \n \t\tlwsl_notice(\u0022%s: calling service on readbuf ah\u005cn\u0022, __func__);\n \t\tpt \u003d \u0026wsi-\u003econtext-\u003ept[(int)wsi-\u003etsi];\ndiff --git a/lib/roles/ws/client-ws.c b/lib/roles/ws/client-ws.c\nindex 2fe5b4f..10b69f0 100644\n--- a/lib/roles/ws/client-ws.c\n+++ b/lib/roles/ws/client-ws.c\n@@ -194,8 +194,8 @@ lws_generate_client_ws_handshake(struct lws *wsi, char *p)\n \tlws_SHA1((unsigned char *)buf, n, (unsigned char *)hash);\n \n \tlws_b64_encode_string(hash, 20,\n-\t\t wsi-\u003eah-\u003einitial_handshake_hash_base64,\n-\t\t sizeof(wsi-\u003eah-\u003einitial_handshake_hash_base64));\n+\t\t wsi-\u003ehttp.ah-\u003einitial_handshake_hash_base64,\n+\t\t sizeof(wsi-\u003ehttp.ah-\u003einitial_handshake_hash_base64));\n \n \treturn p;\n }\n@@ -225,18 +225,18 @@ lws_client_ws_upgrade(struct lws *wsi, const char **cce)\n \t\tgoto bail3;\n \t}\n \n-\tif (wsi-\u003eah-\u003ehttp_response \u003d\u003d 401) {\n+\tif (wsi-\u003ehttp.ah-\u003ehttp_response \u003d\u003d 401) {\n \t\tlwsl_warn(\n \t\t \u0022lws_client_handshake: got bad HTTP response '%d'\u005cn\u0022,\n-\t\t wsi-\u003eah-\u003ehttp_response);\n+\t\t wsi-\u003ehttp.ah-\u003ehttp_response);\n \t\t*cce \u003d \u0022HS: ws upgrade unauthorized\u0022;\n \t\tgoto bail3;\n \t}\n \n-\tif (wsi-\u003eah-\u003ehttp_response !\u003d 101) {\n+\tif (wsi-\u003ehttp.ah-\u003ehttp_response !\u003d 101) {\n \t\tlwsl_warn(\n \t\t \u0022lws_client_handshake: got bad HTTP response '%d'\u005cn\u0022,\n-\t\t wsi-\u003eah-\u003ehttp_response);\n+\t\t wsi-\u003ehttp.ah-\u003ehttp_response);\n \t\t*cce \u003d \u0022HS: ws upgrade response not 101\u0022;\n \t\tgoto bail3;\n \t}\n@@ -544,9 +544,9 @@ check_accept:\n \t */\n \n \tp \u003d lws_hdr_simple_ptr(wsi, WSI_TOKEN_ACCEPT);\n-\tif (strcmp(p, wsi-\u003eah-\u003einitial_handshake_hash_base64)) {\n+\tif (strcmp(p, wsi-\u003ehttp.ah-\u003einitial_handshake_hash_base64)) {\n \t\tlwsl_warn(\u0022lws_client_int_s_hs: accept '%s' wrong vs '%s'\u005cn\u0022, p,\n-\t\t\t\t wsi-\u003eah-\u003einitial_handshake_hash_base64);\n+\t\t\t\t wsi-\u003ehttp.ah-\u003einitial_handshake_hash_base64);\n \t\t*cce \u003d \u0022HS: Accept hash wrong\u0022;\n \t\tgoto bail2;\n \t}\ndiff --git a/lib/roles/ws/ops-ws.c b/lib/roles/ws/ops-ws.c\nindex f94b0ed..13402b4 100644\n--- a/lib/roles/ws/ops-ws.c\n+++ b/lib/roles/ws/ops-ws.c\n@@ -1023,7 +1023,7 @@ read:\n \t\tgoto drain;\n \t}\n \n-\tif (!(pollfd-\u003erevents \u0026 pollfd-\u003eevents \u0026 LWS_POLLIN) \u0026\u0026 !wsi-\u003eah)\n+\tif (!(pollfd-\u003erevents \u0026 pollfd-\u003eevents \u0026 LWS_POLLIN) \u0026\u0026 !wsi-\u003ehttp.ah)\n \t\treturn LWS_HPI_RET_HANDLED;\n \n \tif (lws_is_flowcontrolled(wsi)) {\n@@ -1129,7 +1129,7 @@ drain:\n \t\tebuf.len \u003d 0;\n \t} while (m);\n \n-\tif (wsi-\u003eah\n+\tif (wsi-\u003ehttp.ah\n #if !defined(LWS_NO_CLIENT)\n \t\t\t\u0026\u0026 !wsi-\u003eclient_h2_alpn\n #endif\ndiff --git a/lib/service.c b/lib/service.c\nindex 226bf96..cf2f2b4 100644\n--- a/lib/service.c\n+++ b/lib/service.c\n@@ -240,8 +240,8 @@ __lws_service_timeout_check(struct lws *wsi, time_t sec)\n \t\t\t\t \u0022(did hdr %d, ah %p, wl %d, pfd \u0022\n \t\t\t\t \u0022events %d) %llu vs %llu\u005cn\u0022,\n \t\t\t\t (void *)wsi, wsi-\u003epending_timeout,\n-\t\t\t\t wsi-\u003ehdr_parsing_completed, wsi-\u003eah,\n-\t\t\t\t pt-\u003eah_wait_list_length, n,\n+\t\t\t\t wsi-\u003ehdr_parsing_completed, wsi-\u003ehttp.ah,\n+\t\t\t\t pt-\u003ehttp.ah_wait_list_length, n,\n \t\t\t\t (unsigned long long)sec,\n \t\t\t\t (unsigned long long)wsi-\u003epending_timeout_limit);\n #if defined(LWS_WITH_CGI)\n@@ -613,7 +613,7 @@ lws_service_periodic_checks(struct lws_context *context,\n \t *\t timeout status\n \t */\n \n-\tah \u003d pt-\u003eah_list;\n+\tah \u003d pt-\u003ehttp.ah_list;\n \twhile (ah) {\n \t\tint len;\n \t\tchar buf[256];\n@@ -686,7 +686,7 @@ lws_service_periodic_checks(struct lws_context *context,\n \t\t\t__lws_close_free_wsi(wsi, LWS_CLOSE_STATUS_NOSTATUS,\n \t\t\t\t\t \u0022excessive ah\u0022);\n \n-\t\tah \u003d pt-\u003eah_list;\n+\t\tah \u003d pt-\u003ehttp.ah_list;\n \t}\n \n \tlws_pt_unlock(pt);\n","s":{"c":1713477675,"u": 17613}} ],"g": 18616,"chitpc": 0,"ehitpc": 0,"indexed":0 , "ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}