Fossil SCM

Enable ETag caching of the /uvlist and /juvlist pages.

drh 2020-05-10 12:16 trunk
Commit a6003f1df0f905ac2758f5464ac819a064470d226962eb9e904de372781661ca
+2 -2
--- src/cgi.c
+++ src/cgi.c
@@ -174,12 +174,12 @@
174174
}
175175
176176
/*
177177
** Additional information used to form the HTTP reply
178178
*/
179
-static const char *zContentType = "text/html"; /* Content type of the reply */
180
-static const char *zReplyStatus = "OK"; /* Reply status description */
179
+static const char *zContentType = "text/html"; /* Content type of the reply */
180
+static const char *zReplyStatus = "OK"; /* Reply status description */
181181
static int iReplyStatus = 200; /* Reply status code */
182182
static Blob extraHeader = BLOB_INITIALIZER; /* Extra header text */
183183
static int rangeStart = 0; /* Start of Range: */
184184
static int rangeEnd = 0; /* End of Range: plus 1 */
185185
186186
--- src/cgi.c
+++ src/cgi.c
@@ -174,12 +174,12 @@
174 }
175
176 /*
177 ** Additional information used to form the HTTP reply
178 */
179 static const char *zContentType = "text/html"; /* Content type of the reply */
180 static const char *zReplyStatus = "OK"; /* Reply status description */
181 static int iReplyStatus = 200; /* Reply status code */
182 static Blob extraHeader = BLOB_INITIALIZER; /* Extra header text */
183 static int rangeStart = 0; /* Start of Range: */
184 static int rangeEnd = 0; /* End of Range: plus 1 */
185
186
--- src/cgi.c
+++ src/cgi.c
@@ -174,12 +174,12 @@
174 }
175
176 /*
177 ** Additional information used to form the HTTP reply
178 */
179 static const char *zContentType = "text/html"; /* Content type of the reply */
180 static const char *zReplyStatus = "OK"; /* Reply status description */
181 static int iReplyStatus = 200; /* Reply status code */
182 static Blob extraHeader = BLOB_INITIALIZER; /* Extra header text */
183 static int rangeStart = 0; /* Start of Range: */
184 static int rangeEnd = 0; /* End of Range: plus 1 */
185
186
+1 -1
--- src/etag.c
+++ src/etag.c
@@ -98,11 +98,11 @@
9898
md5sum_step_text("\n", 1);
9999
iMaxAge = 60;
100100
}else if( eFlags & ETAG_CONFIG ){
101101
int iKey = db_int(0, "SELECT value FROM config WHERE name='cfgcnt'");
102102
sqlite3_snprintf(sizeof(zBuf),zBuf,"%d",iKey);
103
- md5sum_step_text("data: ", -1);
103
+ md5sum_step_text("config: ", -1);
104104
md5sum_step_text(zBuf, -1);
105105
md5sum_step_text("\n", 1);
106106
iMaxAge = 3600;
107107
}
108108
109109
--- src/etag.c
+++ src/etag.c
@@ -98,11 +98,11 @@
98 md5sum_step_text("\n", 1);
99 iMaxAge = 60;
100 }else if( eFlags & ETAG_CONFIG ){
101 int iKey = db_int(0, "SELECT value FROM config WHERE name='cfgcnt'");
102 sqlite3_snprintf(sizeof(zBuf),zBuf,"%d",iKey);
103 md5sum_step_text("data: ", -1);
104 md5sum_step_text(zBuf, -1);
105 md5sum_step_text("\n", 1);
106 iMaxAge = 3600;
107 }
108
109
--- src/etag.c
+++ src/etag.c
@@ -98,11 +98,11 @@
98 md5sum_step_text("\n", 1);
99 iMaxAge = 60;
100 }else if( eFlags & ETAG_CONFIG ){
101 int iKey = db_int(0, "SELECT value FROM config WHERE name='cfgcnt'");
102 sqlite3_snprintf(sizeof(zBuf),zBuf,"%d",iKey);
103 md5sum_step_text("config: ", -1);
104 md5sum_step_text(zBuf, -1);
105 md5sum_step_text("\n", 1);
106 iMaxAge = 3600;
107 }
108
109
--- src/unversioned.c
+++ src/unversioned.c
@@ -524,10 +524,11 @@
524524
int showDel = 0;
525525
char zSzName[100];
526526
527527
login_check_credentials();
528528
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
529
+ etag_check(ETAG_DATA,0);
529530
style_header("Unversioned Files");
530531
if( !db_table_exists("repository","unversioned") ){
531532
@ No unversioned files on this server
532533
style_footer();
533534
return;
@@ -636,10 +637,11 @@
636637
Blob json;
637638
638639
login_check_credentials();
639640
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
640641
cgi_set_content_type("text/json");
642
+ etag_check(ETAG_DATA,0);
641643
if( !db_table_exists("repository","unversioned") ){
642644
blob_init(&json, "[]", -1);
643645
cgi_set_content(&json);
644646
return;
645647
}
646648
--- src/unversioned.c
+++ src/unversioned.c
@@ -524,10 +524,11 @@
524 int showDel = 0;
525 char zSzName[100];
526
527 login_check_credentials();
528 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
 
529 style_header("Unversioned Files");
530 if( !db_table_exists("repository","unversioned") ){
531 @ No unversioned files on this server
532 style_footer();
533 return;
@@ -636,10 +637,11 @@
636 Blob json;
637
638 login_check_credentials();
639 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
640 cgi_set_content_type("text/json");
 
641 if( !db_table_exists("repository","unversioned") ){
642 blob_init(&json, "[]", -1);
643 cgi_set_content(&json);
644 return;
645 }
646
--- src/unversioned.c
+++ src/unversioned.c
@@ -524,10 +524,11 @@
524 int showDel = 0;
525 char zSzName[100];
526
527 login_check_credentials();
528 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
529 etag_check(ETAG_DATA,0);
530 style_header("Unversioned Files");
531 if( !db_table_exists("repository","unversioned") ){
532 @ No unversioned files on this server
533 style_footer();
534 return;
@@ -636,10 +637,11 @@
637 Blob json;
638
639 login_check_credentials();
640 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
641 cgi_set_content_type("text/json");
642 etag_check(ETAG_DATA,0);
643 if( !db_table_exists("repository","unversioned") ){
644 blob_init(&json, "[]", -1);
645 cgi_set_content(&json);
646 return;
647 }
648

Keyboard Shortcuts

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