| 837 | } |
| 838 | |
| 839 | void |
| 840 | ts_lua_destroy_http_ctx(ts_lua_http_ctx *http_ctx) |
| 841 | { |
| 842 | ts_lua_cont_info *ci; |
| 843 | |
| 844 | ci = &http_ctx->cinfo; |
| 845 | |
| 846 | if (http_ctx->rri == nullptr) { |
| 847 | if (http_ctx->client_request_url) { |
| 848 | TSHandleMLocRelease(http_ctx->client_request_bufp, http_ctx->client_request_hdrp, http_ctx->client_request_url); |
| 849 | } |
| 850 | |
| 851 | if (http_ctx->client_request_bufp) { |
| 852 | TSHandleMLocRelease(http_ctx->client_request_bufp, TS_NULL_MLOC, http_ctx->client_request_hdrp); |
| 853 | } |
| 854 | } |
| 855 | |
| 856 | if (http_ctx->server_request_url) { |
| 857 | TSHandleMLocRelease(http_ctx->server_request_bufp, http_ctx->server_request_hdrp, http_ctx->server_request_url); |
| 858 | } |
| 859 | |
| 860 | if (http_ctx->server_request_bufp) { |
| 861 | TSHandleMLocRelease(http_ctx->server_request_bufp, TS_NULL_MLOC, http_ctx->server_request_hdrp); |
| 862 | } |
| 863 | |
| 864 | if (http_ctx->server_response_bufp) { |
| 865 | TSHandleMLocRelease(http_ctx->server_response_bufp, TS_NULL_MLOC, http_ctx->server_response_hdrp); |
| 866 | } |
| 867 | |
| 868 | if (http_ctx->client_response_bufp) { |
| 869 | TSHandleMLocRelease(http_ctx->client_response_bufp, TS_NULL_MLOC, http_ctx->client_response_hdrp); |
| 870 | } |
| 871 | |
| 872 | if (http_ctx->cached_response_bufp) { |
| 873 | TSMimeHdrDestroy(http_ctx->cached_response_bufp, http_ctx->cached_response_hdrp); |
| 874 | TSHandleMLocRelease(http_ctx->cached_response_bufp, TS_NULL_MLOC, http_ctx->cached_response_hdrp); |
| 875 | TSMBufferDestroy(http_ctx->cached_response_bufp); |
| 876 | } |
| 877 | |
| 878 | // update thread stats |
| 879 | ts_lua_main_ctx *const main_ctx = ci->routine.mctx; |
| 880 | ts_lua_ctx_stats *const stats = main_ctx->stats; |
| 881 | |
| 882 | TSMutexLock(stats->mutexp); |
| 883 | --stats->threads; |
| 884 | TSMutexUnlock(stats->mutexp); |
| 885 | |
| 886 | ts_lua_release_cont_info(ci); |
| 887 | TSfree(http_ctx); |
| 888 | } |
| 889 | |
| 890 | void |
| 891 | ts_lua_set_http_intercept_ctx(lua_State *L, ts_lua_http_intercept_ctx *ictx) |
no test coverage detected