Fossil SCM

Fixed /builtin to be able to deliver binary content.

stephan 2021-01-05 05:11 trunk
Commit be93625468b03cd43075c904913c58a1af540e8bbed0733ab84b54681c8da4ef
1 file changed +5 -4
+5 -4
--- src/builtin.c
+++ src/builtin.c
@@ -179,16 +179,17 @@
179179
** result is immutable and sets a very large cache retention time (1 year).
180180
*/
181181
void builtin_webpage(void){
182182
Blob out;
183183
const char *zName = P("name");
184
- const char *zTxt = 0;
184
+ const char *zContent = 0;
185
+ int nContent = 0;
185186
const char *zId = P("id");
186187
const char *zType = P("mimetype");
187188
int nId;
188
- if( zName ) zTxt = builtin_text(zName);
189
- if( zTxt==0 ){
189
+ if( zName ) zContent = (const char *)builtin_file(zName, &nContent);
190
+ if( zContent==0 ){
190191
const char *zM = P("m");
191192
if( zM ){
192193
if( zId && (nId = (int)strlen(zId))>=8
193194
&& strncmp(zId,fossil_exe_id(),nId)==0
194195
){
@@ -215,11 +216,11 @@
215216
&& strncmp(zId,fossil_exe_id(),nId)==0
216217
){
217218
g.isConst = 1;
218219
}
219220
etag_check(0,0);
220
- blob_init(&out, zTxt, -1);
221
+ blob_init(&out, zContent, nContent);
221222
cgi_set_content(&out);
222223
}
223224
224225
/* Variables controlling the JS cache.
225226
*/
226227
--- src/builtin.c
+++ src/builtin.c
@@ -179,16 +179,17 @@
179 ** result is immutable and sets a very large cache retention time (1 year).
180 */
181 void builtin_webpage(void){
182 Blob out;
183 const char *zName = P("name");
184 const char *zTxt = 0;
 
185 const char *zId = P("id");
186 const char *zType = P("mimetype");
187 int nId;
188 if( zName ) zTxt = builtin_text(zName);
189 if( zTxt==0 ){
190 const char *zM = P("m");
191 if( zM ){
192 if( zId && (nId = (int)strlen(zId))>=8
193 && strncmp(zId,fossil_exe_id(),nId)==0
194 ){
@@ -215,11 +216,11 @@
215 && strncmp(zId,fossil_exe_id(),nId)==0
216 ){
217 g.isConst = 1;
218 }
219 etag_check(0,0);
220 blob_init(&out, zTxt, -1);
221 cgi_set_content(&out);
222 }
223
224 /* Variables controlling the JS cache.
225 */
226
--- src/builtin.c
+++ src/builtin.c
@@ -179,16 +179,17 @@
179 ** result is immutable and sets a very large cache retention time (1 year).
180 */
181 void builtin_webpage(void){
182 Blob out;
183 const char *zName = P("name");
184 const char *zContent = 0;
185 int nContent = 0;
186 const char *zId = P("id");
187 const char *zType = P("mimetype");
188 int nId;
189 if( zName ) zContent = (const char *)builtin_file(zName, &nContent);
190 if( zContent==0 ){
191 const char *zM = P("m");
192 if( zM ){
193 if( zId && (nId = (int)strlen(zId))>=8
194 && strncmp(zId,fossil_exe_id(),nId)==0
195 ){
@@ -215,11 +216,11 @@
216 && strncmp(zId,fossil_exe_id(),nId)==0
217 ){
218 g.isConst = 1;
219 }
220 etag_check(0,0);
221 blob_init(&out, zContent, nContent);
222 cgi_set_content(&out);
223 }
224
225 /* Variables controlling the JS cache.
226 */
227

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button