Fossil SCM

Merge the enhanced load control measure to trunk.

drh 2022-04-15 13:56 trunk merge
Commit 9413395f5b2306678f7a86b62c636ae4a9cd2fdd699ddd551f6cda0b19ba5b0c
+1 -1
--- src/builtin.c
+++ src/builtin.c
@@ -156,11 +156,11 @@
156156
}
157157
return;
158158
}
159159
160160
/*
161
-** WEBPAGE: builtin
161
+** WEBPAGE: builtin loadavg-exempt
162162
**
163163
** Return one of many built-in content files. Query parameters:
164164
**
165165
** name=FILENAME Return the single file whose name is FILENAME.
166166
** mimetype=TYPE Override the mimetype in the returned file to
167167
--- src/builtin.c
+++ src/builtin.c
@@ -156,11 +156,11 @@
156 }
157 return;
158 }
159
160 /*
161 ** WEBPAGE: builtin
162 **
163 ** Return one of many built-in content files. Query parameters:
164 **
165 ** name=FILENAME Return the single file whose name is FILENAME.
166 ** mimetype=TYPE Override the mimetype in the returned file to
167
--- src/builtin.c
+++ src/builtin.c
@@ -156,11 +156,11 @@
156 }
157 return;
158 }
159
160 /*
161 ** WEBPAGE: builtin loadavg-exempt
162 **
163 ** Return one of many built-in content files. Query parameters:
164 **
165 ** name=FILENAME Return the single file whose name is FILENAME.
166 ** mimetype=TYPE Override the mimetype in the returned file to
167
+6 -6
--- src/chat.c
+++ src/chat.c
@@ -128,11 +128,11 @@
128128
**
129129
** This is the name of the builtin sound file to use for the alert tone.
130130
** The value must be the name of a builtin WAV file.
131131
*/
132132
/*
133
-** WEBPAGE: chat
133
+** WEBPAGE: chat loadavg-exempt
134134
**
135135
** Start up a browser-based chat session.
136136
**
137137
** This is the main page that humans use to access the chatroom. Simply
138138
** point a web-browser at /chat and the screen fills with the latest
@@ -342,11 +342,11 @@
342342
}
343343
fossil_free(zTime);
344344
}
345345
346346
/*
347
-** WEBPAGE: chat-send hidden
347
+** WEBPAGE: chat-send hidden loadavg-exempt
348348
**
349349
** This page receives (via XHR) a new chat-message and/or a new file
350350
** to be entered into the chat history.
351351
**
352352
** On success it responds with an empty response: the new message
@@ -448,11 +448,11 @@
448448
fossil_free(zOut);
449449
}
450450
}
451451
452452
/*
453
-** WEBPAGE: chat-poll hidden
453
+** WEBPAGE: chat-poll hidden loadavg-exempt
454454
**
455455
** The chat page generated by /chat using an XHR to this page to
456456
** request new chat content. A typical invocation is:
457457
**
458458
** /chat-poll/N
@@ -667,11 +667,11 @@
667667
cgi_set_content(&json);
668668
return;
669669
}
670670
671671
/*
672
-** WEBPAGE: chat-fetch-one hidden
672
+** WEBPAGE: chat-fetch-one hidden loadavg-exempt
673673
**
674674
** /chat-fetch-one/N
675675
**
676676
** Fetches a single message with the given ID, if available.
677677
**
@@ -744,11 +744,11 @@
744744
}
745745
db_finalize(&q);
746746
}
747747
748748
/*
749
-** WEBPAGE: chat-download hidden
749
+** WEBPAGE: chat-download hidden loadavg-exempt
750750
**
751751
** Download the CHAT.FILE attachment associated with a single chat
752752
** entry. The "name" query parameter begins with an integer that
753753
** identifies the particular chat message. The integer may be followed
754754
** by a / and a filename, which will indicate to the browser to use
@@ -777,11 +777,11 @@
777777
cgi_set_content(&r);
778778
}
779779
780780
781781
/*
782
-** WEBPAGE: chat-delete hidden
782
+** WEBPAGE: chat-delete hidden loadavg-exempt
783783
**
784784
** Delete the chat entry identified by the name query parameter.
785785
** Invoking fetch("chat-delete/"+msgid) from javascript in the client
786786
** will delete a chat entry from the CHAT table.
787787
**
788788
--- src/chat.c
+++ src/chat.c
@@ -128,11 +128,11 @@
128 **
129 ** This is the name of the builtin sound file to use for the alert tone.
130 ** The value must be the name of a builtin WAV file.
131 */
132 /*
133 ** WEBPAGE: chat
134 **
135 ** Start up a browser-based chat session.
136 **
137 ** This is the main page that humans use to access the chatroom. Simply
138 ** point a web-browser at /chat and the screen fills with the latest
@@ -342,11 +342,11 @@
342 }
343 fossil_free(zTime);
344 }
345
346 /*
347 ** WEBPAGE: chat-send hidden
348 **
349 ** This page receives (via XHR) a new chat-message and/or a new file
350 ** to be entered into the chat history.
351 **
352 ** On success it responds with an empty response: the new message
@@ -448,11 +448,11 @@
448 fossil_free(zOut);
449 }
450 }
451
452 /*
453 ** WEBPAGE: chat-poll hidden
454 **
455 ** The chat page generated by /chat using an XHR to this page to
456 ** request new chat content. A typical invocation is:
457 **
458 ** /chat-poll/N
@@ -667,11 +667,11 @@
667 cgi_set_content(&json);
668 return;
669 }
670
671 /*
672 ** WEBPAGE: chat-fetch-one hidden
673 **
674 ** /chat-fetch-one/N
675 **
676 ** Fetches a single message with the given ID, if available.
677 **
@@ -744,11 +744,11 @@
744 }
745 db_finalize(&q);
746 }
747
748 /*
749 ** WEBPAGE: chat-download hidden
750 **
751 ** Download the CHAT.FILE attachment associated with a single chat
752 ** entry. The "name" query parameter begins with an integer that
753 ** identifies the particular chat message. The integer may be followed
754 ** by a / and a filename, which will indicate to the browser to use
@@ -777,11 +777,11 @@
777 cgi_set_content(&r);
778 }
779
780
781 /*
782 ** WEBPAGE: chat-delete hidden
783 **
784 ** Delete the chat entry identified by the name query parameter.
785 ** Invoking fetch("chat-delete/"+msgid) from javascript in the client
786 ** will delete a chat entry from the CHAT table.
787 **
788
--- src/chat.c
+++ src/chat.c
@@ -128,11 +128,11 @@
128 **
129 ** This is the name of the builtin sound file to use for the alert tone.
130 ** The value must be the name of a builtin WAV file.
131 */
132 /*
133 ** WEBPAGE: chat loadavg-exempt
134 **
135 ** Start up a browser-based chat session.
136 **
137 ** This is the main page that humans use to access the chatroom. Simply
138 ** point a web-browser at /chat and the screen fills with the latest
@@ -342,11 +342,11 @@
342 }
343 fossil_free(zTime);
344 }
345
346 /*
347 ** WEBPAGE: chat-send hidden loadavg-exempt
348 **
349 ** This page receives (via XHR) a new chat-message and/or a new file
350 ** to be entered into the chat history.
351 **
352 ** On success it responds with an empty response: the new message
@@ -448,11 +448,11 @@
448 fossil_free(zOut);
449 }
450 }
451
452 /*
453 ** WEBPAGE: chat-poll hidden loadavg-exempt
454 **
455 ** The chat page generated by /chat using an XHR to this page to
456 ** request new chat content. A typical invocation is:
457 **
458 ** /chat-poll/N
@@ -667,11 +667,11 @@
667 cgi_set_content(&json);
668 return;
669 }
670
671 /*
672 ** WEBPAGE: chat-fetch-one hidden loadavg-exempt
673 **
674 ** /chat-fetch-one/N
675 **
676 ** Fetches a single message with the given ID, if available.
677 **
@@ -744,11 +744,11 @@
744 }
745 db_finalize(&q);
746 }
747
748 /*
749 ** WEBPAGE: chat-download hidden loadavg-exempt
750 **
751 ** Download the CHAT.FILE attachment associated with a single chat
752 ** entry. The "name" query parameter begins with an integer that
753 ** identifies the particular chat message. The integer may be followed
754 ** by a / and a filename, which will indicate to the browser to use
@@ -777,11 +777,11 @@
777 cgi_set_content(&r);
778 }
779
780
781 /*
782 ** WEBPAGE: chat-delete hidden loadavg-exempt
783 **
784 ** Delete the chat entry identified by the name query parameter.
785 ** Invoking fetch("chat-delete/"+msgid) from javascript in the client
786 ** will delete a chat entry from the CHAT table.
787 **
788
+1 -1
--- src/diff.c
+++ src/diff.c
@@ -3594,11 +3594,11 @@
35943594
35953595
/* Gather query parameters */
35963596
login_check_credentials();
35973597
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
35983598
if( exclude_spiders() ) return;
3599
- load_control();
3599
+ fossil_nice_default();
36003600
zFilename = P("filename");
36013601
zRevision = PD("checkin",0);
36023602
zOrigin = P("origin");
36033603
zLimit = P("limit");
36043604
showLog = PB("log");
36053605
--- src/diff.c
+++ src/diff.c
@@ -3594,11 +3594,11 @@
3594
3595 /* Gather query parameters */
3596 login_check_credentials();
3597 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
3598 if( exclude_spiders() ) return;
3599 load_control();
3600 zFilename = P("filename");
3601 zRevision = PD("checkin",0);
3602 zOrigin = P("origin");
3603 zLimit = P("limit");
3604 showLog = PB("log");
3605
--- src/diff.c
+++ src/diff.c
@@ -3594,11 +3594,11 @@
3594
3595 /* Gather query parameters */
3596 login_check_credentials();
3597 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
3598 if( exclude_spiders() ) return;
3599 fossil_nice_default();
3600 zFilename = P("filename");
3601 zRevision = PD("checkin",0);
3602 zOrigin = P("origin");
3603 zLimit = P("limit");
3604 showLog = PB("log");
3605
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -1182,9 +1182,10 @@
11821182
DiffConfig DCfg;
11831183
login_check_credentials();
11841184
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
11851185
if( zFrom==0 || zTo==0 ) fossil_redirect_home();
11861186
1187
+ fossil_nice_default();
11871188
cgi_set_content_type("text/plain");
11881189
diff_config_init(&DCfg, DIFF_VERBOSE);
11891190
diff_two_versions(zFrom, zTo, &DCfg, 0);
11901191
}
11911192
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -1182,9 +1182,10 @@
1182 DiffConfig DCfg;
1183 login_check_credentials();
1184 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
1185 if( zFrom==0 || zTo==0 ) fossil_redirect_home();
1186
 
1187 cgi_set_content_type("text/plain");
1188 diff_config_init(&DCfg, DIFF_VERBOSE);
1189 diff_two_versions(zFrom, zTo, &DCfg, 0);
1190 }
1191
--- src/diffcmd.c
+++ src/diffcmd.c
@@ -1182,9 +1182,10 @@
1182 DiffConfig DCfg;
1183 login_check_credentials();
1184 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
1185 if( zFrom==0 || zTo==0 ) fossil_redirect_home();
1186
1187 fossil_nice_default();
1188 cgi_set_content_type("text/plain");
1189 diff_config_init(&DCfg, DIFF_VERBOSE);
1190 diff_two_versions(zFrom, zTo, &DCfg, 0);
1191 }
1192
+13 -12
--- src/dispatch.c
+++ src/dispatch.c
@@ -38,22 +38,23 @@
3838
3939
/***************************************************************************
4040
** These macros must match similar macros in mkindex.c
4141
** Allowed values for CmdOrPage.eCmdFlags.
4242
*/
43
-#define CMDFLAG_1ST_TIER 0x0001 /* Most important commands */
44
-#define CMDFLAG_2ND_TIER 0x0002 /* Obscure and seldom used commands */
45
-#define CMDFLAG_TEST 0x0004 /* Commands for testing only */
46
-#define CMDFLAG_WEBPAGE 0x0008 /* Web pages */
47
-#define CMDFLAG_COMMAND 0x0010 /* A command */
48
-#define CMDFLAG_SETTING 0x0020 /* A setting */
49
-#define CMDFLAG_VERSIONABLE 0x0040 /* A versionable setting */
50
-#define CMDFLAG_BLOCKTEXT 0x0080 /* Multi-line text setting */
51
-#define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */
52
-#define CMDFLAG_RAWCONTENT 0x0200 /* Do not interpret POST content */
53
-/* NOTE: 0x0400 = CMDFLAG_SENSITIVE in mkindex.c! */
54
-#define CMDFLAG_HIDDEN 0x0800 /* Elide from most listings */
43
+#define CMDFLAG_1ST_TIER 0x0001 /* Most important commands */
44
+#define CMDFLAG_2ND_TIER 0x0002 /* Obscure and seldom used commands */
45
+#define CMDFLAG_TEST 0x0004 /* Commands for testing only */
46
+#define CMDFLAG_WEBPAGE 0x0008 /* Web pages */
47
+#define CMDFLAG_COMMAND 0x0010 /* A command */
48
+#define CMDFLAG_SETTING 0x0020 /* A setting */
49
+#define CMDFLAG_VERSIONABLE 0x0040 /* A versionable setting */
50
+#define CMDFLAG_BLOCKTEXT 0x0080 /* Multi-line text setting */
51
+#define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */
52
+#define CMDFLAG_RAWCONTENT 0x0200 /* Do not interpret POST content */
53
+/* NOTE: 0x0400 = CMDFLAG_SENSITIVE in mkindex.c! */
54
+#define CMDFLAG_HIDDEN 0x0800 /* Elide from most listings */
55
+#define CMDFLAG_LDAVG_EXEMPT 0x1000 /* Exempt from load_control() */
5556
/**************************************************************************/
5657
5758
/* Values for the 2nd parameter to dispatch_name_search() */
5859
#define CMDFLAG_ANY 0x0038 /* Match anything */
5960
#define CMDFLAG_PREFIX 0x0200 /* Prefix match is ok */
6061
--- src/dispatch.c
+++ src/dispatch.c
@@ -38,22 +38,23 @@
38
39 /***************************************************************************
40 ** These macros must match similar macros in mkindex.c
41 ** Allowed values for CmdOrPage.eCmdFlags.
42 */
43 #define CMDFLAG_1ST_TIER 0x0001 /* Most important commands */
44 #define CMDFLAG_2ND_TIER 0x0002 /* Obscure and seldom used commands */
45 #define CMDFLAG_TEST 0x0004 /* Commands for testing only */
46 #define CMDFLAG_WEBPAGE 0x0008 /* Web pages */
47 #define CMDFLAG_COMMAND 0x0010 /* A command */
48 #define CMDFLAG_SETTING 0x0020 /* A setting */
49 #define CMDFLAG_VERSIONABLE 0x0040 /* A versionable setting */
50 #define CMDFLAG_BLOCKTEXT 0x0080 /* Multi-line text setting */
51 #define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */
52 #define CMDFLAG_RAWCONTENT 0x0200 /* Do not interpret POST content */
53 /* NOTE: 0x0400 = CMDFLAG_SENSITIVE in mkindex.c! */
54 #define CMDFLAG_HIDDEN 0x0800 /* Elide from most listings */
 
55 /**************************************************************************/
56
57 /* Values for the 2nd parameter to dispatch_name_search() */
58 #define CMDFLAG_ANY 0x0038 /* Match anything */
59 #define CMDFLAG_PREFIX 0x0200 /* Prefix match is ok */
60
--- src/dispatch.c
+++ src/dispatch.c
@@ -38,22 +38,23 @@
38
39 /***************************************************************************
40 ** These macros must match similar macros in mkindex.c
41 ** Allowed values for CmdOrPage.eCmdFlags.
42 */
43 #define CMDFLAG_1ST_TIER 0x0001 /* Most important commands */
44 #define CMDFLAG_2ND_TIER 0x0002 /* Obscure and seldom used commands */
45 #define CMDFLAG_TEST 0x0004 /* Commands for testing only */
46 #define CMDFLAG_WEBPAGE 0x0008 /* Web pages */
47 #define CMDFLAG_COMMAND 0x0010 /* A command */
48 #define CMDFLAG_SETTING 0x0020 /* A setting */
49 #define CMDFLAG_VERSIONABLE 0x0040 /* A versionable setting */
50 #define CMDFLAG_BLOCKTEXT 0x0080 /* Multi-line text setting */
51 #define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */
52 #define CMDFLAG_RAWCONTENT 0x0200 /* Do not interpret POST content */
53 /* NOTE: 0x0400 = CMDFLAG_SENSITIVE in mkindex.c! */
54 #define CMDFLAG_HIDDEN 0x0800 /* Elide from most listings */
55 #define CMDFLAG_LDAVG_EXEMPT 0x1000 /* Exempt from load_control() */
56 /**************************************************************************/
57
58 /* Values for the 2nd parameter to dispatch_name_search() */
59 #define CMDFLAG_ANY 0x0038 /* Match anything */
60 #define CMDFLAG_PREFIX 0x0200 /* Prefix match is ok */
61
+1 -1
--- src/info.c
+++ src/info.c
@@ -1182,11 +1182,11 @@
11821182
int bInvert = PB("inv");
11831183
11841184
login_check_credentials();
11851185
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
11861186
login_anonymous_available();
1187
- load_control();
1187
+ fossil_nice_default();
11881188
blob_init(&qp, 0, 0);
11891189
diffType = preferred_diff_type();
11901190
zRe = P("regex");
11911191
if( zRe ) re_compile(&pRe, zRe, 0);
11921192
zBranch = P("branch");
11931193
--- src/info.c
+++ src/info.c
@@ -1182,11 +1182,11 @@
1182 int bInvert = PB("inv");
1183
1184 login_check_credentials();
1185 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
1186 login_anonymous_available();
1187 load_control();
1188 blob_init(&qp, 0, 0);
1189 diffType = preferred_diff_type();
1190 zRe = P("regex");
1191 if( zRe ) re_compile(&pRe, zRe, 0);
1192 zBranch = P("branch");
1193
--- src/info.c
+++ src/info.c
@@ -1182,11 +1182,11 @@
1182 int bInvert = PB("inv");
1183
1184 login_check_credentials();
1185 if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
1186 login_anonymous_available();
1187 fossil_nice_default();
1188 blob_init(&qp, 0, 0);
1189 diffType = preferred_diff_type();
1190 zRe = P("regex");
1191 if( zRe ) re_compile(&pRe, zRe, 0);
1192 zBranch = P("branch");
1193
+2 -2
--- src/json.c
+++ src/json.c
@@ -739,11 +739,11 @@
739739
** been called. In general, this function should be used sparingly,
740740
** e.g. from low-level support functions like fossil_warning() where
741741
** there is genuine uncertainty about whether (or not) the JSON setup
742742
** has already been called.
743743
*/
744
-int json_is_bootstrapped_early(){
744
+int json_is_bootstrapped_early(void){
745745
return ((g.json.gc.v != NULL) && (g.json.gc.a != NULL));
746746
}
747747
748748
/*
749749
** Initializes some JSON bits which need to be initialized relatively
@@ -758,11 +758,11 @@
758758
** up. e.g. it must not use cgi_parameter() and friends because this
759759
** must be called before those data are initialized.
760760
**
761761
** If called multiple times, calls after the first are a no-op.
762762
*/
763
-void json_bootstrap_early(){
763
+void json_bootstrap_early(void){
764764
cson_value * v;
765765
766766
if(g.json.gc.v!=NULL){
767767
/* Avoid multiple bootstrappings. */
768768
return;
769769
--- src/json.c
+++ src/json.c
@@ -739,11 +739,11 @@
739 ** been called. In general, this function should be used sparingly,
740 ** e.g. from low-level support functions like fossil_warning() where
741 ** there is genuine uncertainty about whether (or not) the JSON setup
742 ** has already been called.
743 */
744 int json_is_bootstrapped_early(){
745 return ((g.json.gc.v != NULL) && (g.json.gc.a != NULL));
746 }
747
748 /*
749 ** Initializes some JSON bits which need to be initialized relatively
@@ -758,11 +758,11 @@
758 ** up. e.g. it must not use cgi_parameter() and friends because this
759 ** must be called before those data are initialized.
760 **
761 ** If called multiple times, calls after the first are a no-op.
762 */
763 void json_bootstrap_early(){
764 cson_value * v;
765
766 if(g.json.gc.v!=NULL){
767 /* Avoid multiple bootstrappings. */
768 return;
769
--- src/json.c
+++ src/json.c
@@ -739,11 +739,11 @@
739 ** been called. In general, this function should be used sparingly,
740 ** e.g. from low-level support functions like fossil_warning() where
741 ** there is genuine uncertainty about whether (or not) the JSON setup
742 ** has already been called.
743 */
744 int json_is_bootstrapped_early(void){
745 return ((g.json.gc.v != NULL) && (g.json.gc.a != NULL));
746 }
747
748 /*
749 ** Initializes some JSON bits which need to be initialized relatively
@@ -758,11 +758,11 @@
758 ** up. e.g. it must not use cgi_parameter() and friends because this
759 ** must be called before those data are initialized.
760 **
761 ** If called multiple times, calls after the first are a no-op.
762 */
763 void json_bootstrap_early(void){
764 cson_value * v;
765
766 if(g.json.gc.v!=NULL){
767 /* Avoid multiple bootstrappings. */
768 return;
769
+11 -2
--- src/loadctrl.c
+++ src/loadctrl.c
@@ -45,16 +45,25 @@
4545
void loadavg_test_cmd(void){
4646
fossil_print("load-average: %f\n", load_average());
4747
}
4848
4949
/*
50
-** Abort the current operation of the load average of the host computer
51
-** is too high.
50
+** Abort the current page request if the load average of the host
51
+** computer is too high. Admin and Setup users are exempt from this
52
+** restriction.
5253
*/
5354
void load_control(void){
5455
double mxLoad = atof(db_get("max-loadavg", 0));
56
+#if 1
57
+ /* Disable this block only to test load restrictions */
5558
if( mxLoad<=0.0 || mxLoad>=load_average() ) return;
59
+
60
+ login_check_credentials();
61
+ if(g.perm.Admin || g.perm.Setup){
62
+ return;
63
+ }
64
+#endif
5665
5766
style_set_current_feature("test");
5867
style_header("Server Overload");
5968
@ <h2>The server load is currently too high.
6069
@ Please try again later.</h2>
6170
--- src/loadctrl.c
+++ src/loadctrl.c
@@ -45,16 +45,25 @@
45 void loadavg_test_cmd(void){
46 fossil_print("load-average: %f\n", load_average());
47 }
48
49 /*
50 ** Abort the current operation of the load average of the host computer
51 ** is too high.
 
52 */
53 void load_control(void){
54 double mxLoad = atof(db_get("max-loadavg", 0));
 
 
55 if( mxLoad<=0.0 || mxLoad>=load_average() ) return;
 
 
 
 
 
 
56
57 style_set_current_feature("test");
58 style_header("Server Overload");
59 @ <h2>The server load is currently too high.
60 @ Please try again later.</h2>
61
--- src/loadctrl.c
+++ src/loadctrl.c
@@ -45,16 +45,25 @@
45 void loadavg_test_cmd(void){
46 fossil_print("load-average: %f\n", load_average());
47 }
48
49 /*
50 ** Abort the current page request if the load average of the host
51 ** computer is too high. Admin and Setup users are exempt from this
52 ** restriction.
53 */
54 void load_control(void){
55 double mxLoad = atof(db_get("max-loadavg", 0));
56 #if 1
57 /* Disable this block only to test load restrictions */
58 if( mxLoad<=0.0 || mxLoad>=load_average() ) return;
59
60 login_check_credentials();
61 if(g.perm.Admin || g.perm.Setup){
62 return;
63 }
64 #endif
65
66 style_set_current_feature("test");
67 style_header("Server Overload");
68 @ <h2>The server load is currently too high.
69 @ Please try again later.</h2>
70
--- src/login.c
+++ src/login.c
@@ -985,10 +985,11 @@
985985
** g.userUid Database USER.UID value. Might be -1 for "nobody"
986986
** g.zLogin Database USER.LOGIN value. NULL for user "nobody"
987987
** g.perm Permissions granted to this user
988988
** g.anon Permissions that would be available to anonymous
989989
** g.isHuman True if the user is human, not a spider or robot
990
+** g.perm Populated based on user account's capabilities
990991
**
991992
*/
992993
void login_check_credentials(void){
993994
int uid = 0; /* User id */
994995
const char *zCookie; /* Text of the login cookie */
995996
--- src/login.c
+++ src/login.c
@@ -985,10 +985,11 @@
985 ** g.userUid Database USER.UID value. Might be -1 for "nobody"
986 ** g.zLogin Database USER.LOGIN value. NULL for user "nobody"
987 ** g.perm Permissions granted to this user
988 ** g.anon Permissions that would be available to anonymous
989 ** g.isHuman True if the user is human, not a spider or robot
 
990 **
991 */
992 void login_check_credentials(void){
993 int uid = 0; /* User id */
994 const char *zCookie; /* Text of the login cookie */
995
--- src/login.c
+++ src/login.c
@@ -985,10 +985,11 @@
985 ** g.userUid Database USER.UID value. Might be -1 for "nobody"
986 ** g.zLogin Database USER.LOGIN value. NULL for user "nobody"
987 ** g.perm Permissions granted to this user
988 ** g.anon Permissions that would be available to anonymous
989 ** g.isHuman True if the user is human, not a spider or robot
990 ** g.perm Populated based on user account's capabilities
991 **
992 */
993 void login_check_credentials(void){
994 int uid = 0; /* User id */
995 const char *zCookie; /* Text of the login cookie */
996
+3 -1
--- src/main.c
+++ src/main.c
@@ -1873,11 +1873,10 @@
18731873
18741874
/* At this point, the appropriate repository database file will have
18751875
** been opened.
18761876
*/
18771877
1878
-
18791878
/*
18801879
** Check to see if the first term of PATH_INFO specifies an
18811880
** alternative skin. This will be the case if the first term of
18821881
** PATH_INFO begins with "draftN/" where N is an integer between 1
18831882
** and 9. If so, activate the skin associated with that draft.
@@ -2016,10 +2015,13 @@
20162015
@ <h1>Server Configuration Error</h1>
20172016
@ <p>The database schema on the server is out-of-date. Please ask
20182017
@ the administrator to run <b>fossil rebuild</b>.</p>
20192018
}
20202019
}else{
2020
+ if(0==(CMDFLAG_LDAVG_EXEMPT & pCmd->eCmdFlags)){
2021
+ load_control();
2022
+ }
20212023
#ifdef FOSSIL_ENABLE_JSON
20222024
static int jsonOnce = 0;
20232025
if( jsonOnce==0 && g.json.isJsonMode!=0 ){
20242026
assert(json_is_bootstrapped_early());
20252027
json_bootstrap_late();
20262028
--- src/main.c
+++ src/main.c
@@ -1873,11 +1873,10 @@
1873
1874 /* At this point, the appropriate repository database file will have
1875 ** been opened.
1876 */
1877
1878
1879 /*
1880 ** Check to see if the first term of PATH_INFO specifies an
1881 ** alternative skin. This will be the case if the first term of
1882 ** PATH_INFO begins with "draftN/" where N is an integer between 1
1883 ** and 9. If so, activate the skin associated with that draft.
@@ -2016,10 +2015,13 @@
2016 @ <h1>Server Configuration Error</h1>
2017 @ <p>The database schema on the server is out-of-date. Please ask
2018 @ the administrator to run <b>fossil rebuild</b>.</p>
2019 }
2020 }else{
 
 
 
2021 #ifdef FOSSIL_ENABLE_JSON
2022 static int jsonOnce = 0;
2023 if( jsonOnce==0 && g.json.isJsonMode!=0 ){
2024 assert(json_is_bootstrapped_early());
2025 json_bootstrap_late();
2026
--- src/main.c
+++ src/main.c
@@ -1873,11 +1873,10 @@
1873
1874 /* At this point, the appropriate repository database file will have
1875 ** been opened.
1876 */
1877
 
1878 /*
1879 ** Check to see if the first term of PATH_INFO specifies an
1880 ** alternative skin. This will be the case if the first term of
1881 ** PATH_INFO begins with "draftN/" where N is an integer between 1
1882 ** and 9. If so, activate the skin associated with that draft.
@@ -2016,10 +2015,13 @@
2015 @ <h1>Server Configuration Error</h1>
2016 @ <p>The database schema on the server is out-of-date. Please ask
2017 @ the administrator to run <b>fossil rebuild</b>.</p>
2018 }
2019 }else{
2020 if(0==(CMDFLAG_LDAVG_EXEMPT & pCmd->eCmdFlags)){
2021 load_control();
2022 }
2023 #ifdef FOSSIL_ENABLE_JSON
2024 static int jsonOnce = 0;
2025 if( jsonOnce==0 && g.json.isJsonMode!=0 ){
2026 assert(json_is_bootstrapped_early());
2027 json_bootstrap_late();
2028
+1 -1
--- src/stat.c
+++ src/stat.c
@@ -963,11 +963,11 @@
963963
*/
964964
if( !g.perm.Write && !db_get_boolean("artifact_stats_enable",0) ){
965965
login_needed(g.anon.Write);
966966
return;
967967
}
968
- load_control();
968
+ fossil_nice_default();
969969
970970
style_set_current_feature("stat");
971971
style_header("Artifact Statistics");
972972
style_submenu_element("Repository Stats", "stat");
973973
style_submenu_element("Artifact List", "bloblist");
974974
--- src/stat.c
+++ src/stat.c
@@ -963,11 +963,11 @@
963 */
964 if( !g.perm.Write && !db_get_boolean("artifact_stats_enable",0) ){
965 login_needed(g.anon.Write);
966 return;
967 }
968 load_control();
969
970 style_set_current_feature("stat");
971 style_header("Artifact Statistics");
972 style_submenu_element("Repository Stats", "stat");
973 style_submenu_element("Artifact List", "bloblist");
974
--- src/stat.c
+++ src/stat.c
@@ -963,11 +963,11 @@
963 */
964 if( !g.perm.Write && !db_get_boolean("artifact_stats_enable",0) ){
965 login_needed(g.anon.Write);
966 return;
967 }
968 fossil_nice_default();
969
970 style_set_current_feature("stat");
971 style_header("Artifact Statistics");
972 style_submenu_element("Repository Stats", "stat");
973 style_submenu_element("Artifact List", "bloblist");
974
+1 -1
--- src/style.c
+++ src/style.c
@@ -1210,11 +1210,11 @@
12101210
** default.css. */
12111211
fossil_free(zFile);
12121212
}
12131213
12141214
/*
1215
-** WEBPAGE: style.css
1215
+** WEBPAGE: style.css loadavg-exempt
12161216
**
12171217
** Return the style sheet. The style sheet is assemblied from
12181218
** multiple sources, in order:
12191219
**
12201220
** (1) The built-in "default.css" style sheet containing basic defaults.
12211221
--- src/style.c
+++ src/style.c
@@ -1210,11 +1210,11 @@
1210 ** default.css. */
1211 fossil_free(zFile);
1212 }
1213
1214 /*
1215 ** WEBPAGE: style.css
1216 **
1217 ** Return the style sheet. The style sheet is assemblied from
1218 ** multiple sources, in order:
1219 **
1220 ** (1) The built-in "default.css" style sheet containing basic defaults.
1221
--- src/style.c
+++ src/style.c
@@ -1210,11 +1210,11 @@
1210 ** default.css. */
1211 fossil_free(zFile);
1212 }
1213
1214 /*
1215 ** WEBPAGE: style.css loadavg-exempt
1216 **
1217 ** Return the style sheet. The style sheet is assemblied from
1218 ** multiple sources, in order:
1219 **
1220 ** (1) The built-in "default.css" style sheet containing basic defaults.
1221
+1 -1
--- src/tar.c
+++ src/tar.c
@@ -756,11 +756,11 @@
756756
Blob tarball; /* Tarball accumulated here */
757757
const char *z;
758758
759759
login_check_credentials();
760760
if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; }
761
- load_control();
761
+ fossil_nice_default();
762762
zName = fossil_strdup(PD("name",""));
763763
z = P("r");
764764
if( z==0 ) z = P("uuid");
765765
if( z==0 ) z = tar_uuid_from_name(&zName);
766766
if( z==0 ) z = "trunk";
767767
--- src/tar.c
+++ src/tar.c
@@ -756,11 +756,11 @@
756 Blob tarball; /* Tarball accumulated here */
757 const char *z;
758
759 login_check_credentials();
760 if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; }
761 load_control();
762 zName = fossil_strdup(PD("name",""));
763 z = P("r");
764 if( z==0 ) z = P("uuid");
765 if( z==0 ) z = tar_uuid_from_name(&zName);
766 if( z==0 ) z = "trunk";
767
--- src/tar.c
+++ src/tar.c
@@ -756,11 +756,11 @@
756 Blob tarball; /* Tarball accumulated here */
757 const char *z;
758
759 login_check_credentials();
760 if( !g.perm.Zip ){ login_needed(g.anon.Zip); return; }
761 fossil_nice_default();
762 zName = fossil_strdup(PD("name",""));
763 z = P("r");
764 if( z==0 ) z = P("uuid");
765 if( z==0 ) z = tar_uuid_from_name(&zName);
766 if( z==0 ) z = "trunk";
767
+19
--- src/util.c
+++ src/util.c
@@ -896,5 +896,24 @@
896896
}
897897
}
898898
#endif
899899
return zBrowser;
900900
}
901
+
902
+/*
903
+** On non-Windows systems, calls nice(2) with the given level. Errors
904
+** are ignored. On Windows this is a no-op.
905
+*/
906
+void fossil_nice(int level){
907
+#ifndef _WIN32
908
+ nice(level);
909
+#else
910
+ (void)level;
911
+#endif
912
+}
913
+
914
+/*
915
+** Calls fossil_nice() with a default level.
916
+*/
917
+void fossil_nice_default(void){
918
+ fossil_nice(20);
919
+}
901920
--- src/util.c
+++ src/util.c
@@ -896,5 +896,24 @@
896 }
897 }
898 #endif
899 return zBrowser;
900 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
901
--- src/util.c
+++ src/util.c
@@ -896,5 +896,24 @@
896 }
897 }
898 #endif
899 return zBrowser;
900 }
901
902 /*
903 ** On non-Windows systems, calls nice(2) with the given level. Errors
904 ** are ignored. On Windows this is a no-op.
905 */
906 void fossil_nice(int level){
907 #ifndef _WIN32
908 nice(level);
909 #else
910 (void)level;
911 #endif
912 }
913
914 /*
915 ** Calls fossil_nice() with a default level.
916 */
917 void fossil_nice_default(void){
918 fossil_nice(20);
919 }
920
+1 -1
--- src/zip.c
+++ src/zip.c
@@ -921,11 +921,11 @@
921921
zType = "SQL";
922922
}else{
923923
eType = ARCHIVE_ZIP;
924924
zType = "ZIP";
925925
}
926
- load_control();
926
+ fossil_nice_default();
927927
zName = fossil_strdup(PD("name",""));
928928
z = P("r");
929929
if( z==0 ) z = P("uuid");
930930
if( z==0 ) z = tar_uuid_from_name(&zName);
931931
if( z==0 ) z = "trunk";
932932
--- src/zip.c
+++ src/zip.c
@@ -921,11 +921,11 @@
921 zType = "SQL";
922 }else{
923 eType = ARCHIVE_ZIP;
924 zType = "ZIP";
925 }
926 load_control();
927 zName = fossil_strdup(PD("name",""));
928 z = P("r");
929 if( z==0 ) z = P("uuid");
930 if( z==0 ) z = tar_uuid_from_name(&zName);
931 if( z==0 ) z = "trunk";
932
--- src/zip.c
+++ src/zip.c
@@ -921,11 +921,11 @@
921 zType = "SQL";
922 }else{
923 eType = ARCHIVE_ZIP;
924 zType = "ZIP";
925 }
926 fossil_nice_default();
927 zName = fossil_strdup(PD("name",""));
928 z = P("r");
929 if( z==0 ) z = P("uuid");
930 if( z==0 ) z = tar_uuid_from_name(&zName);
931 if( z==0 ) z = "trunk";
932
+15 -12
--- tools/mkindex.c
+++ tools/mkindex.c
@@ -80,22 +80,23 @@
8080
8181
/***************************************************************************
8282
** These macros must match similar macros in dispatch.c.
8383
**
8484
** Allowed values for CmdOrPage.eCmdFlags. */
85
-#define CMDFLAG_1ST_TIER 0x0001 /* Most important commands */
86
-#define CMDFLAG_2ND_TIER 0x0002 /* Obscure and seldom used commands */
87
-#define CMDFLAG_TEST 0x0004 /* Commands for testing only */
88
-#define CMDFLAG_WEBPAGE 0x0008 /* Web pages */
89
-#define CMDFLAG_COMMAND 0x0010 /* A command */
90
-#define CMDFLAG_SETTING 0x0020 /* A setting */
91
-#define CMDFLAG_VERSIONABLE 0x0040 /* A versionable setting */
92
-#define CMDFLAG_BLOCKTEXT 0x0080 /* Multi-line text setting */
93
-#define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */
94
-#define CMDFLAG_RAWCONTENT 0x0200 /* Do not interpret webpage content */
95
-#define CMDFLAG_SENSITIVE 0x0400 /* Security-sensitive setting */
96
-#define CMDFLAG_HIDDEN 0x0800 /* Elide from most listings */
85
+#define CMDFLAG_1ST_TIER 0x0001 /* Most important commands */
86
+#define CMDFLAG_2ND_TIER 0x0002 /* Obscure and seldom used commands */
87
+#define CMDFLAG_TEST 0x0004 /* Commands for testing only */
88
+#define CMDFLAG_WEBPAGE 0x0008 /* Web pages */
89
+#define CMDFLAG_COMMAND 0x0010 /* A command */
90
+#define CMDFLAG_SETTING 0x0020 /* A setting */
91
+#define CMDFLAG_VERSIONABLE 0x0040 /* A versionable setting */
92
+#define CMDFLAG_BLOCKTEXT 0x0080 /* Multi-line text setting */
93
+#define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */
94
+#define CMDFLAG_RAWCONTENT 0x0200 /* Do not interpret webpage content */
95
+#define CMDFLAG_SENSITIVE 0x0400 /* Security-sensitive setting */
96
+#define CMDFLAG_HIDDEN 0x0800 /* Elide from most listings */
97
+#define CMDFLAG_LDAVG_EXEMPT 0x1000 /* Exempt from load_control() */
9798
/**************************************************************************/
9899
99100
/*
100101
** Each entry looks like this:
101102
*/
@@ -260,10 +261,12 @@
260261
aEntry[nUsed].zDflt = string_dup(&zLine[i+8], j-8);
261262
}else if( j>9 && strncmp(&zLine[i], "variable=", 9)==0 ){
262263
aEntry[nUsed].zVar = string_dup(&zLine[i+9], j-9);
263264
}else if( j==6 && strncmp(&zLine[i], "hidden", 6)==0 ){
264265
aEntry[nUsed].eType |= CMDFLAG_HIDDEN;
266
+ }else if( j==14 && strncmp(&zLine[i], "loadavg-exempt", 14)==0 ){
267
+ aEntry[nUsed].eType |= CMDFLAG_LDAVG_EXEMPT;
265268
}else{
266269
fprintf(stderr, "%s:%d: unknown option: '%.*s'\n",
267270
zFile, nLine, j, &zLine[i]);
268271
nErr++;
269272
}
270273
--- tools/mkindex.c
+++ tools/mkindex.c
@@ -80,22 +80,23 @@
80
81 /***************************************************************************
82 ** These macros must match similar macros in dispatch.c.
83 **
84 ** Allowed values for CmdOrPage.eCmdFlags. */
85 #define CMDFLAG_1ST_TIER 0x0001 /* Most important commands */
86 #define CMDFLAG_2ND_TIER 0x0002 /* Obscure and seldom used commands */
87 #define CMDFLAG_TEST 0x0004 /* Commands for testing only */
88 #define CMDFLAG_WEBPAGE 0x0008 /* Web pages */
89 #define CMDFLAG_COMMAND 0x0010 /* A command */
90 #define CMDFLAG_SETTING 0x0020 /* A setting */
91 #define CMDFLAG_VERSIONABLE 0x0040 /* A versionable setting */
92 #define CMDFLAG_BLOCKTEXT 0x0080 /* Multi-line text setting */
93 #define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */
94 #define CMDFLAG_RAWCONTENT 0x0200 /* Do not interpret webpage content */
95 #define CMDFLAG_SENSITIVE 0x0400 /* Security-sensitive setting */
96 #define CMDFLAG_HIDDEN 0x0800 /* Elide from most listings */
 
97 /**************************************************************************/
98
99 /*
100 ** Each entry looks like this:
101 */
@@ -260,10 +261,12 @@
260 aEntry[nUsed].zDflt = string_dup(&zLine[i+8], j-8);
261 }else if( j>9 && strncmp(&zLine[i], "variable=", 9)==0 ){
262 aEntry[nUsed].zVar = string_dup(&zLine[i+9], j-9);
263 }else if( j==6 && strncmp(&zLine[i], "hidden", 6)==0 ){
264 aEntry[nUsed].eType |= CMDFLAG_HIDDEN;
 
 
265 }else{
266 fprintf(stderr, "%s:%d: unknown option: '%.*s'\n",
267 zFile, nLine, j, &zLine[i]);
268 nErr++;
269 }
270
--- tools/mkindex.c
+++ tools/mkindex.c
@@ -80,22 +80,23 @@
80
81 /***************************************************************************
82 ** These macros must match similar macros in dispatch.c.
83 **
84 ** Allowed values for CmdOrPage.eCmdFlags. */
85 #define CMDFLAG_1ST_TIER 0x0001 /* Most important commands */
86 #define CMDFLAG_2ND_TIER 0x0002 /* Obscure and seldom used commands */
87 #define CMDFLAG_TEST 0x0004 /* Commands for testing only */
88 #define CMDFLAG_WEBPAGE 0x0008 /* Web pages */
89 #define CMDFLAG_COMMAND 0x0010 /* A command */
90 #define CMDFLAG_SETTING 0x0020 /* A setting */
91 #define CMDFLAG_VERSIONABLE 0x0040 /* A versionable setting */
92 #define CMDFLAG_BLOCKTEXT 0x0080 /* Multi-line text setting */
93 #define CMDFLAG_BOOLEAN 0x0100 /* A boolean setting */
94 #define CMDFLAG_RAWCONTENT 0x0200 /* Do not interpret webpage content */
95 #define CMDFLAG_SENSITIVE 0x0400 /* Security-sensitive setting */
96 #define CMDFLAG_HIDDEN 0x0800 /* Elide from most listings */
97 #define CMDFLAG_LDAVG_EXEMPT 0x1000 /* Exempt from load_control() */
98 /**************************************************************************/
99
100 /*
101 ** Each entry looks like this:
102 */
@@ -260,10 +261,12 @@
261 aEntry[nUsed].zDflt = string_dup(&zLine[i+8], j-8);
262 }else if( j>9 && strncmp(&zLine[i], "variable=", 9)==0 ){
263 aEntry[nUsed].zVar = string_dup(&zLine[i+9], j-9);
264 }else if( j==6 && strncmp(&zLine[i], "hidden", 6)==0 ){
265 aEntry[nUsed].eType |= CMDFLAG_HIDDEN;
266 }else if( j==14 && strncmp(&zLine[i], "loadavg-exempt", 14)==0 ){
267 aEntry[nUsed].eType |= CMDFLAG_LDAVG_EXEMPT;
268 }else{
269 fprintf(stderr, "%s:%d: unknown option: '%.*s'\n",
270 zFile, nLine, j, &zLine[i]);
271 nErr++;
272 }
273

Keyboard Shortcuts

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