Fossil SCM
Fixed /builtin to be able to deliver binary content.
Commit
be93625468b03cd43075c904913c58a1af540e8bbed0733ab84b54681c8da4ef
Parent
e514bb5b830945d…
1 file changed
+5
-4
+5
-4
| --- src/builtin.c | ||
| +++ src/builtin.c | ||
| @@ -179,16 +179,17 @@ | ||
| 179 | 179 | ** result is immutable and sets a very large cache retention time (1 year). |
| 180 | 180 | */ |
| 181 | 181 | void builtin_webpage(void){ |
| 182 | 182 | Blob out; |
| 183 | 183 | const char *zName = P("name"); |
| 184 | - const char *zTxt = 0; | |
| 184 | + const char *zContent = 0; | |
| 185 | + int nContent = 0; | |
| 185 | 186 | const char *zId = P("id"); |
| 186 | 187 | const char *zType = P("mimetype"); |
| 187 | 188 | 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 ){ | |
| 190 | 191 | const char *zM = P("m"); |
| 191 | 192 | if( zM ){ |
| 192 | 193 | if( zId && (nId = (int)strlen(zId))>=8 |
| 193 | 194 | && strncmp(zId,fossil_exe_id(),nId)==0 |
| 194 | 195 | ){ |
| @@ -215,11 +216,11 @@ | ||
| 215 | 216 | && strncmp(zId,fossil_exe_id(),nId)==0 |
| 216 | 217 | ){ |
| 217 | 218 | g.isConst = 1; |
| 218 | 219 | } |
| 219 | 220 | etag_check(0,0); |
| 220 | - blob_init(&out, zTxt, -1); | |
| 221 | + blob_init(&out, zContent, nContent); | |
| 221 | 222 | cgi_set_content(&out); |
| 222 | 223 | } |
| 223 | 224 | |
| 224 | 225 | /* Variables controlling the JS cache. |
| 225 | 226 | */ |
| 226 | 227 |
| --- 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 |