Fossil SCM
When calling Th_Render() recursively, pass on g.th1Flags so that recursive calls do not inadvertently toggle flags like TH_INIT_NO_ENCODE.
Commit
0a57df7e07759dc8b8798fda1a96829ff2789cf57714dfdb2d4238f25a144dee
Parent
a381a8102b6819b…
1 file changed
+4
-2
+4
-2
| --- src/th_main.c | ||
| +++ src/th_main.c | ||
| @@ -2918,20 +2918,22 @@ | ||
| 2918 | 2918 | ** This routine processes the template and writes the results to one |
| 2919 | 2919 | ** of stdout, CGI, or an internal blob which was set up via a prior |
| 2920 | 2920 | ** call to Th_SetOutputBlob(). |
| 2921 | 2921 | */ |
| 2922 | 2922 | int Th_Render(const char *z){ |
| 2923 | - return Th_RenderToBlob(z, pThOut, 0) | |
| 2923 | + return Th_RenderToBlob(z, pThOut, g.th1Flags) | |
| 2924 | 2924 | /* Maintenance reminder: on most calls to Th_Render(), e.g. for |
| 2925 | 2925 | ** outputing the site skin, pThOut will be 0, which means that |
| 2926 | 2926 | ** Th_RenderToBlob() will output directly to the CGI buffer (in |
| 2927 | 2927 | ** CGI mode) or stdout (in CLI mode). Recursive calls, however, |
| 2928 | 2928 | ** e.g. via the "render" script function binding, need to use the |
| 2929 | 2929 | ** pThOut blob in order to avoid out-of-order output if |
| 2930 | 2930 | ** Th_SetOutputBlob() has been called. If it has not been called, |
| 2931 | 2931 | ** pThOut will be 0, which will redirect the output to CGI/stdout, |
| 2932 | - ** as appropriate. | |
| 2932 | + ** as appropriate. We need to pass on g.th1Flags for the case of | |
| 2933 | + ** recursive calls, so that, e.g., TH_INIT_NO_ENCODE does not get | |
| 2934 | + ** inadvertently toggled off by a recursive call. | |
| 2933 | 2935 | */; |
| 2934 | 2936 | } |
| 2935 | 2937 | |
| 2936 | 2938 | /* |
| 2937 | 2939 | ** COMMAND: test-th-render |
| 2938 | 2940 |
| --- src/th_main.c | |
| +++ src/th_main.c | |
| @@ -2918,20 +2918,22 @@ | |
| 2918 | ** This routine processes the template and writes the results to one |
| 2919 | ** of stdout, CGI, or an internal blob which was set up via a prior |
| 2920 | ** call to Th_SetOutputBlob(). |
| 2921 | */ |
| 2922 | int Th_Render(const char *z){ |
| 2923 | return Th_RenderToBlob(z, pThOut, 0) |
| 2924 | /* Maintenance reminder: on most calls to Th_Render(), e.g. for |
| 2925 | ** outputing the site skin, pThOut will be 0, which means that |
| 2926 | ** Th_RenderToBlob() will output directly to the CGI buffer (in |
| 2927 | ** CGI mode) or stdout (in CLI mode). Recursive calls, however, |
| 2928 | ** e.g. via the "render" script function binding, need to use the |
| 2929 | ** pThOut blob in order to avoid out-of-order output if |
| 2930 | ** Th_SetOutputBlob() has been called. If it has not been called, |
| 2931 | ** pThOut will be 0, which will redirect the output to CGI/stdout, |
| 2932 | ** as appropriate. |
| 2933 | */; |
| 2934 | } |
| 2935 | |
| 2936 | /* |
| 2937 | ** COMMAND: test-th-render |
| 2938 |
| --- src/th_main.c | |
| +++ src/th_main.c | |
| @@ -2918,20 +2918,22 @@ | |
| 2918 | ** This routine processes the template and writes the results to one |
| 2919 | ** of stdout, CGI, or an internal blob which was set up via a prior |
| 2920 | ** call to Th_SetOutputBlob(). |
| 2921 | */ |
| 2922 | int Th_Render(const char *z){ |
| 2923 | return Th_RenderToBlob(z, pThOut, g.th1Flags) |
| 2924 | /* Maintenance reminder: on most calls to Th_Render(), e.g. for |
| 2925 | ** outputing the site skin, pThOut will be 0, which means that |
| 2926 | ** Th_RenderToBlob() will output directly to the CGI buffer (in |
| 2927 | ** CGI mode) or stdout (in CLI mode). Recursive calls, however, |
| 2928 | ** e.g. via the "render" script function binding, need to use the |
| 2929 | ** pThOut blob in order to avoid out-of-order output if |
| 2930 | ** Th_SetOutputBlob() has been called. If it has not been called, |
| 2931 | ** pThOut will be 0, which will redirect the output to CGI/stdout, |
| 2932 | ** as appropriate. We need to pass on g.th1Flags for the case of |
| 2933 | ** recursive calls, so that, e.g., TH_INIT_NO_ENCODE does not get |
| 2934 | ** inadvertently toggled off by a recursive call. |
| 2935 | */; |
| 2936 | } |
| 2937 | |
| 2938 | /* |
| 2939 | ** COMMAND: test-th-render |
| 2940 |