Fossil SCM

Cause browsers to cache the logo and style sheet.

drh 2010-01-23 21:48 trunk
Commit 08c0a9ff0c4e7f2e36c9a84dc9757d09e7bc98d4
+2 -1
--- src/cgi.c
+++ src/cgi.c
@@ -311,16 +311,17 @@
311311
/*time_t expires = time(0) + atoi(db_config("constant_expires","604800"));*/
312312
time_t expires = time(0) + 604800;
313313
char * zDate = cgi_rfc822_datestamp(expires);
314314
fprintf(g.httpOut, "Expires: %s\r\n", zDate );
315315
if( zDate[0] ) free( zDate );
316
+ }else{
317
+ fprintf(g.httpOut, "Cache-control: no-cache, no-store\r\n");
316318
}
317319
318320
/* Content intended for logged in users should only be cached in
319321
** the browser, not some shared location.
320322
*/
321
- fprintf(g.httpOut, "Cache-control: no-cache, no-store\r\n");
322323
fprintf(g.httpOut, "Content-Type: %s; charset=utf-8\r\n", zContentType);
323324
if( strcmp(zContentType,"application/x-fossil")==0 ){
324325
cgi_combine_header_and_body();
325326
blob_compress(&cgiContent[0], &cgiContent[0]);
326327
}
327328
--- src/cgi.c
+++ src/cgi.c
@@ -311,16 +311,17 @@
311 /*time_t expires = time(0) + atoi(db_config("constant_expires","604800"));*/
312 time_t expires = time(0) + 604800;
313 char * zDate = cgi_rfc822_datestamp(expires);
314 fprintf(g.httpOut, "Expires: %s\r\n", zDate );
315 if( zDate[0] ) free( zDate );
 
 
316 }
317
318 /* Content intended for logged in users should only be cached in
319 ** the browser, not some shared location.
320 */
321 fprintf(g.httpOut, "Cache-control: no-cache, no-store\r\n");
322 fprintf(g.httpOut, "Content-Type: %s; charset=utf-8\r\n", zContentType);
323 if( strcmp(zContentType,"application/x-fossil")==0 ){
324 cgi_combine_header_and_body();
325 blob_compress(&cgiContent[0], &cgiContent[0]);
326 }
327
--- src/cgi.c
+++ src/cgi.c
@@ -311,16 +311,17 @@
311 /*time_t expires = time(0) + atoi(db_config("constant_expires","604800"));*/
312 time_t expires = time(0) + 604800;
313 char * zDate = cgi_rfc822_datestamp(expires);
314 fprintf(g.httpOut, "Expires: %s\r\n", zDate );
315 if( zDate[0] ) free( zDate );
316 }else{
317 fprintf(g.httpOut, "Cache-control: no-cache, no-store\r\n");
318 }
319
320 /* Content intended for logged in users should only be cached in
321 ** the browser, not some shared location.
322 */
 
323 fprintf(g.httpOut, "Content-Type: %s; charset=utf-8\r\n", zContentType);
324 if( strcmp(zContentType,"application/x-fossil")==0 ){
325 cgi_combine_header_and_body();
326 blob_compress(&cgiContent[0], &cgiContent[0]);
327 }
328
+1
--- src/doc.c
+++ src/doc.c
@@ -561,6 +561,7 @@
561561
if( blob_size(&logo)==0 ){
562562
blob_init(&logo, (char*)aLogo, sizeof(aLogo));
563563
}
564564
cgi_set_content_type(zMime);
565565
cgi_set_content(&logo);
566
+ g.isConst = 1;
566567
}
567568
--- src/doc.c
+++ src/doc.c
@@ -561,6 +561,7 @@
561 if( blob_size(&logo)==0 ){
562 blob_init(&logo, (char*)aLogo, sizeof(aLogo));
563 }
564 cgi_set_content_type(zMime);
565 cgi_set_content(&logo);
 
566 }
567
--- src/doc.c
+++ src/doc.c
@@ -561,6 +561,7 @@
561 if( blob_size(&logo)==0 ){
562 blob_init(&logo, (char*)aLogo, sizeof(aLogo));
563 }
564 cgi_set_content_type(zMime);
565 cgi_set_content(&logo);
566 g.isConst = 1;
567 }
568
+17
--- src/setup.c
+++ src/setup.c
@@ -962,22 +962,30 @@
962962
}
963963
db_begin_transaction();
964964
if( P("clear")!=0 ){
965965
db_multi_exec("DELETE FROM config WHERE name='css'");
966966
cgi_replace_parameter("css", zDefaultCSS);
967
+ db_end_transaction(0);
968
+ cgi_redirect("setup_editcss");
967969
}else{
968970
textarea_attribute(0, 0, 0, "css", "css", zDefaultCSS);
969971
}
972
+ if( P("submit")!=0 ){
973
+ db_end_transaction(0);
974
+ cgi_redirect("setup_editcss");
975
+ }
970976
style_header("Edit CSS");
971977
@ <form action="%s(g.zBaseURL)/setup_editcss" method="POST">
972978
login_insert_csrf_secret();
973979
@ Edit the CSS below:<br />
974980
textarea_attribute("", 40, 80, "css", "css", zDefaultCSS);
975981
@ <br />
976982
@ <input type="submit" name="submit" value="Apply Changes">
977983
@ <input type="submit" name="clear" value="Revert To Default">
978984
@ </form>
985
+ @ <p><b>Note:</b> Press your browser Reload button after modifying the
986
+ @ CSS in order to pull in the modified CSS file.</p>
979987
@ <hr>
980988
@ The default CSS is shown below for reference. Other examples
981989
@ of CSS files can be seen on the <a href="setup_skin">skins page</a>.
982990
@ See also the <a href="setup_header">header</a> and
983991
@ <a href="setup_footer">footer</a> editing screens.
@@ -1091,14 +1099,18 @@
10911099
db_finalize(&ins);
10921100
db_multi_exec(
10931101
"REPLACE INTO config(name, value) VALUES('logo-mimetype',%Q)",
10941102
zMime
10951103
);
1104
+ db_end_transaction(0);
1105
+ cgi_redirect("setup_logo");
10961106
}else if( P("clr")!=0 ){
10971107
db_multi_exec(
10981108
"DELETE FROM config WHERE name GLOB 'logo-*'"
10991109
);
1110
+ db_end_transaction(0);
1111
+ cgi_redirect("setup_logo");
11001112
}
11011113
style_header("Edit Project Logo");
11021114
@ <p>The current project logo has a MIME-Type of <b>%h(zMime)</b> and looks
11031115
@ like this:</p>
11041116
@ <blockquote><img src="%s(g.zTop)/logo" alt="logo"></blockquote>
@@ -1117,8 +1129,13 @@
11171129
@ Logo Image file:
11181130
@ <input type="file" name="im" size="60" accepts="image/*"><br>
11191131
@ <input type="submit" name="set" value="Change Logo">
11201132
@ <input type="submit" name="clr" value="Revert To Default">
11211133
@ </form>
1134
+ @
1135
+ @ <p><b>Note:</b> Your browser has probably cached the logo image, so
1136
+ @ you will probably need to press the Reload button on your browser after
1137
+ @ changing the logo to provoke your browser to reload the new logo image.
1138
+ @ </p>
11221139
style_footer();
11231140
db_end_transaction(0);
11241141
}
11251142
--- src/setup.c
+++ src/setup.c
@@ -962,22 +962,30 @@
962 }
963 db_begin_transaction();
964 if( P("clear")!=0 ){
965 db_multi_exec("DELETE FROM config WHERE name='css'");
966 cgi_replace_parameter("css", zDefaultCSS);
 
 
967 }else{
968 textarea_attribute(0, 0, 0, "css", "css", zDefaultCSS);
969 }
 
 
 
 
970 style_header("Edit CSS");
971 @ <form action="%s(g.zBaseURL)/setup_editcss" method="POST">
972 login_insert_csrf_secret();
973 @ Edit the CSS below:<br />
974 textarea_attribute("", 40, 80, "css", "css", zDefaultCSS);
975 @ <br />
976 @ <input type="submit" name="submit" value="Apply Changes">
977 @ <input type="submit" name="clear" value="Revert To Default">
978 @ </form>
 
 
979 @ <hr>
980 @ The default CSS is shown below for reference. Other examples
981 @ of CSS files can be seen on the <a href="setup_skin">skins page</a>.
982 @ See also the <a href="setup_header">header</a> and
983 @ <a href="setup_footer">footer</a> editing screens.
@@ -1091,14 +1099,18 @@
1091 db_finalize(&ins);
1092 db_multi_exec(
1093 "REPLACE INTO config(name, value) VALUES('logo-mimetype',%Q)",
1094 zMime
1095 );
 
 
1096 }else if( P("clr")!=0 ){
1097 db_multi_exec(
1098 "DELETE FROM config WHERE name GLOB 'logo-*'"
1099 );
 
 
1100 }
1101 style_header("Edit Project Logo");
1102 @ <p>The current project logo has a MIME-Type of <b>%h(zMime)</b> and looks
1103 @ like this:</p>
1104 @ <blockquote><img src="%s(g.zTop)/logo" alt="logo"></blockquote>
@@ -1117,8 +1129,13 @@
1117 @ Logo Image file:
1118 @ <input type="file" name="im" size="60" accepts="image/*"><br>
1119 @ <input type="submit" name="set" value="Change Logo">
1120 @ <input type="submit" name="clr" value="Revert To Default">
1121 @ </form>
 
 
 
 
 
1122 style_footer();
1123 db_end_transaction(0);
1124 }
1125
--- src/setup.c
+++ src/setup.c
@@ -962,22 +962,30 @@
962 }
963 db_begin_transaction();
964 if( P("clear")!=0 ){
965 db_multi_exec("DELETE FROM config WHERE name='css'");
966 cgi_replace_parameter("css", zDefaultCSS);
967 db_end_transaction(0);
968 cgi_redirect("setup_editcss");
969 }else{
970 textarea_attribute(0, 0, 0, "css", "css", zDefaultCSS);
971 }
972 if( P("submit")!=0 ){
973 db_end_transaction(0);
974 cgi_redirect("setup_editcss");
975 }
976 style_header("Edit CSS");
977 @ <form action="%s(g.zBaseURL)/setup_editcss" method="POST">
978 login_insert_csrf_secret();
979 @ Edit the CSS below:<br />
980 textarea_attribute("", 40, 80, "css", "css", zDefaultCSS);
981 @ <br />
982 @ <input type="submit" name="submit" value="Apply Changes">
983 @ <input type="submit" name="clear" value="Revert To Default">
984 @ </form>
985 @ <p><b>Note:</b> Press your browser Reload button after modifying the
986 @ CSS in order to pull in the modified CSS file.</p>
987 @ <hr>
988 @ The default CSS is shown below for reference. Other examples
989 @ of CSS files can be seen on the <a href="setup_skin">skins page</a>.
990 @ See also the <a href="setup_header">header</a> and
991 @ <a href="setup_footer">footer</a> editing screens.
@@ -1091,14 +1099,18 @@
1099 db_finalize(&ins);
1100 db_multi_exec(
1101 "REPLACE INTO config(name, value) VALUES('logo-mimetype',%Q)",
1102 zMime
1103 );
1104 db_end_transaction(0);
1105 cgi_redirect("setup_logo");
1106 }else if( P("clr")!=0 ){
1107 db_multi_exec(
1108 "DELETE FROM config WHERE name GLOB 'logo-*'"
1109 );
1110 db_end_transaction(0);
1111 cgi_redirect("setup_logo");
1112 }
1113 style_header("Edit Project Logo");
1114 @ <p>The current project logo has a MIME-Type of <b>%h(zMime)</b> and looks
1115 @ like this:</p>
1116 @ <blockquote><img src="%s(g.zTop)/logo" alt="logo"></blockquote>
@@ -1117,8 +1129,13 @@
1129 @ Logo Image file:
1130 @ <input type="file" name="im" size="60" accepts="image/*"><br>
1131 @ <input type="submit" name="set" value="Change Logo">
1132 @ <input type="submit" name="clr" value="Revert To Default">
1133 @ </form>
1134 @
1135 @ <p><b>Note:</b> Your browser has probably cached the logo image, so
1136 @ you will probably need to press the Reload button on your browser after
1137 @ changing the logo to provoke your browser to reload the new logo image.
1138 @ </p>
1139 style_footer();
1140 db_end_transaction(0);
1141 }
1142
--- src/style.c
+++ src/style.c
@@ -391,10 +391,11 @@
391391
char *zCSS = 0;
392392
393393
cgi_set_content_type("text/css");
394394
zCSS = db_get("css",(char*)zDefaultCSS);
395395
cgi_append_content(zCSS, -1);
396
+ g.isConst = 1;
396397
}
397398
398399
/*
399400
** WEBPAGE: test_env
400401
*/
401402
--- src/style.c
+++ src/style.c
@@ -391,10 +391,11 @@
391 char *zCSS = 0;
392
393 cgi_set_content_type("text/css");
394 zCSS = db_get("css",(char*)zDefaultCSS);
395 cgi_append_content(zCSS, -1);
 
396 }
397
398 /*
399 ** WEBPAGE: test_env
400 */
401
--- src/style.c
+++ src/style.c
@@ -391,10 +391,11 @@
391 char *zCSS = 0;
392
393 cgi_set_content_type("text/css");
394 zCSS = db_get("css",(char*)zDefaultCSS);
395 cgi_append_content(zCSS, -1);
396 g.isConst = 1;
397 }
398
399 /*
400 ** WEBPAGE: test_env
401 */
402

Keyboard Shortcuts

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