Fossil

Check-in [8c9ea22419]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Reordered /builtin a bit to allow it to respond with a 304 *without* generating extraneous output if etag_check() says it can.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | ajax-wiki-editor
Files: files | file ages | folders
SHA3-256: 8c9ea224194389c541ecd6f985a4994a8dd62e29afc883d98a44c3f077be24be
User & Date: stephan 2020-07-31 17:31:05.792
Context
2020-07-31
18:49
Made all tab elements hidden on /fileedit to lessen the impact of FOUC before JS assembles the tabbed interface. ... (check-in: 99f288d2a5 user: stephan tags: ajax-wiki-editor)
17:31
Reordered /builtin a bit to allow it to respond with a 304 *without* generating extraneous output if etag_check() says it can. ... (check-in: 8c9ea22419 user: stephan tags: ajax-wiki-editor)
16:49
Pedantic function rename, as it will become relevant when work on the ajaxifying the forum start. ... (check-in: 41ce65fc31 user: stephan tags: ajax-wiki-editor)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/style.c.
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202





1203





1204
1205
1206
1207
1208
1209
1210
1211

1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
/*
** WEBPAGE: builtin
** URL:  builtin/FILENAME
**
** Return the built-in text given by FILENAME.  This is used internally 
** by many Fossil web pages to load built-in javascript files.
**
** If the id= or cache= query parameter is present, then Fossil
** assumes that the result is immutable and sets a very large cache
** retention time (1 year).
*/
void page_builtin_text(void){
  Blob out;
  const char *zName = P("name");
  const char *zTxt = 0;
  const char *zId = PD("id",P("cache"));
  int nId;
  int isBundle = 0;






  if( zName ){





    if(':'==zName[0]){
      isBundle = 1;
      zTxt = page_builtin_text_bundle(zName+1) ? "" : NULL;
    }else{
      zTxt = builtin_text(zName);
    }
  }
  if( zTxt==0 ){

    cgi_set_status(404, "Not Found");
    @ File "%h(zName)" not found
    return;
  }
  if( sqlite3_strglob("*.js", zName)==0 ){
    cgi_set_content_type("application/javascript");
  }else{
    cgi_set_content_type("text/plain");
  }
  if( zId && (nId = (int)strlen(zId))>=8 && strncmp(zId,MANIFEST_UUID,nId)==0 ){
    g.isConst = 1;
  }else{
    etag_check(0,0);
  }
  if(isBundle==0){
    blob_init(&out, zTxt, -1);
    cgi_set_content(&out);
  }
}

/*
** All possible capabilities







|
|
|





|



>
>
>
>
>

>
>
>
>
>








>


<
<
<
<
<
<
<
<
<
<
<
<
|







1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224












1225
1226
1227
1228
1229
1230
1231
1232
/*
** WEBPAGE: builtin
** URL:  builtin/FILENAME
**
** Return the built-in text given by FILENAME.  This is used internally 
** by many Fossil web pages to load built-in javascript files.
**
** If the id= parameter is present, then Fossil assumes that the
** result is immutable and sets a very large cache retention time (1
** year).
*/
void page_builtin_text(void){
  Blob out;
  const char *zName = P("name");
  const char *zTxt = 0;
  const char *zId = P("id");
  int nId;
  int isBundle = 0;

  if( zId && (nId = (int)strlen(zId))>=8 && strncmp(zId,MANIFEST_UUID,nId)==0 ){
    g.isConst = 1;
  }else{
    etag_check(0,0)/*might not return*/;
  }
  if( zName ){
    if( sqlite3_strglob("*.js", zName)==0 ){
      cgi_set_content_type("application/javascript");
    }else{
      cgi_set_content_type("text/plain");
    }
    if(':'==zName[0]){
      isBundle = 1;
      zTxt = page_builtin_text_bundle(zName+1) ? "" : NULL;
    }else{
      zTxt = builtin_text(zName);
    }
  }
  if( zTxt==0 ){
    cgi_set_content_type("text/html");
    cgi_set_status(404, "Not Found");
    @ File "%h(zName)" not found












  }else if(isBundle==0){
    blob_init(&out, zTxt, -1);
    cgi_set_content(&out);
  }
}

/*
** All possible capabilities